how to insert multiple fields in laravel?

I have a table that has :




like this.

<input type="text" name="role[]" value="father">
<input type="text" name="role[]" value="mother">

<input type="text" name="name[]" value="Anton">
<input type="text" name="name[]" value="Shirley">

<input type="text" name="age[]" value="53">
<input type="text" name="age[]" value="49">

how ever I can only save the role[] only.

here is my code :

foreach(Input::get('role') as $i)

                $data = new Family_background();

                $data -> role = $i;
                $data -> name = Input::get('name');
                $data -> age = Input::get('age');
                $data -> save();


p.s I suck at this.

any help will be appreciated. thanks.

Source: laravel

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.