I have a multiple select:
Form::select('color', array('1' => 'Red', '2' => 'Blue', '3' => 'Green', ... ), null, array('multiple'));
How can I insert these values into a table on separate rows, like this:
  id  |  user_id  |  color
----------------------------
   1  |     1     |    1
   2  |     1     |    2
   3  |     1     |    3
   4  |     1     |    4
   5  |     2     |    1
   6  |     2     |    3
In the above example, user with an id of 1 selected 4 different values in the select and each was inserted on a separate row.
I have this working in this way:
foreach (Input::get('tags') as $key => $value)
{
    $user_color = new UserColor;
    $user_color->user_id = $user->id;
    $user_color->color = $key;
    $user_color->save();
}
Is there a better way of doing this? It seems odd using a foreach loop when it feels like Laravel should have some sort of built-in method of inserting multiple values on multiple rows.
 
     
    