-1
I’m populating a checkbox with the bank information, I’m trying to get it to read all the checkbox selected.
Controller
public function store(RequestProduto $request)
{
$data = new Produtos;
$data->nome_visivel = $request->nome_visivel;
$data->nome = $request->nome;
$data->pdf = $request->pdf;
$data->keywords = $request->keywords;
$data->save();
return Redirect::to('adm/produto')->with('return', 'Dados salvos com sucesso');
}
View
@foreach($atributos as $key => $value)
<input type="checkbox" name="nome[]" value="{{$value->nome}}">{{$value->nome}}
@endforeach
How do you know he’s selected ? I don’t quite understand what you need.
– Diego Souza
@Gumball I don’t just want it to save only one checkbox value, I need it to return me all the selected values
– Evandro Barbosa
Is that you didn’t post the
HTML
complete, understood the question, each name belongs to a new product or all these names will be saved in the same product? name = checkbox’s selected, right?– Kenny Rafael
That @Kennyrafael
– Evandro Barbosa
If I leave name="name", it saves only the last check
– Evandro Barbosa
But you will concatenate all of them to save or each will generate a new record?
– Kenny Rafael
I want to concatenate everyone
– Evandro Barbosa