Support the ongoing development of Laravel.io →
Input Forms
Last updated 2 years ago.
0

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
          ]);
     }
}
Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.