I have a project_group pivot table with these fields: id, group_id, project_id, admin_id, user_id
This I use to combine groups and projects together:
$group -> projects() -> attach($projects,array('admin_id' => Auth::user()->id));
Is it possible to add diffirent user_id for each record in this pivot table.
For instance:
First recording:
id = 1, group_id = 1 project_id = 2 admin_id = 1 user_id = 1
Second entry:
id = 2, group_id = 1 project_id = 3 admin_id = 1 user_id = 1
3rd record:
id = 3, group_id = 1 project_id = 2 admin_id = 1 user_id = 2
4th record:
id = 3, group_id = 1 project_id = 3 admin_id = 1 user_id = 2
Basically, if I select 2 projects from the list of html projects and 2 users from the list of html users, I need to get the result, as in the example above ...
source share