How to save multiple inputs with the same name in Laravel?

0

How to save multiple inputs with the same name in Laravel ?

{!! Form::text('dependente[]', null, ['class' => 'form-control']); !!}
{!! Form::text('dependente[]', null, ['class' => 'form-control']); !!}
{!! Form::text('dependente[]', null, ['class' => 'form-control']); !!}
{!! Form::text('dependente[]', null, ['class' => 'form-control']); !!}

I made a foreach in controller but the error appears:

  

Invalid argument supplied for foreach() :

$dependente = new dependente;
foreach($request->dependente as $key => $v)
{
     $data = array('civil_id'=> $civil->id,
                   'nome'=> $request->dependente [$key],
                   'data_nascimento'=> $request->nasc_dependente [$key], 
                   'estuda'=> $request->nasc_dependente [$key]
             );                  
     dependente::insert($data);
     dd($request->dependente);
}
    
asked by anonymous 10.01.2018 / 14:15

0 answers