question_id, report_id, user_id all found on pivot table.
$questions = Question::lists('id');
$k = User::find($user);
foreach($questions as $question) {
$report->user()->attach($k, ['question_id' => $question]);
}
This is deleting the existing user linked to the report and replacing it with this user. I want the result to be two users linked to the report. There are always 5 questions this will stay the same but need to be applied to table for each user linked to a report...
***ALSO if i want to delete a user from a report how would i do that???
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1NRY18g
via IFTTT
Aucun commentaire:
Enregistrer un commentaire