Well, I do something similar with assigning some roles to users. I loop through my values and insert now rows. My Input::get('roles') is a checkbox group from my input form. I don't know if it will help, but my code looks something like this:
$roles = Input::get('roles');
$stamp = date('Y-m-d H:i:s');
if(count($roles) > 0){
foreach($roles as $role){
DB::table('my_role_table'->insert([
'user'=>Input::get('user'),
'vendor'=>Input::get('vendor'),
'role'=>$role,
'created_at'=>$stamp,
'updated_at'=>$stamp
]);
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community