I'm new to laravel and I have doubts about how to take checkboxes and check if they have been selected, I also have the question of how to go through the arrangement. In my controller I want to enter 1 when it is true and 9 when it is false but I do not know how to set the values because I do not even take them and enter the database.
Here part of my view
<div class="col-sm-3">
@php($titulo="")
@foreach ($catalogocomponente as $cat)
@if($cat->tipo!=$titulo&&$cat->num_tipo %2 == 1)
<div class="title">
<h3></h3>
</div>
@endif
@if($cat->num_tipo %2 == 1)
<div class="checkbox">
<label>
<input type="checkbox" id="check[]" name="check[]" value="" onchange="javascript:showContent()">
</label>
<input name="" type="hidden" value="">
</div>
<!------------------ desplegable ---------------->
<div id="content[]" style="display: none;">
<div class="col-md-12">
<div class="form-group label-floating">
<input type="text" name="description" class="form-control">
</div>
</div>
</div>
<!------------------ desplegable ---------------->
@endif
@php($titulo=$cat->tipo)
@endforeach
</div>
Here my store controller
public function store(Request $request){
if ($request){
$catalogocomponente=DB::table('catalogo_componente');
$data=array();
// define('i',1);
// i+1;
//$cameraVideo = $request->input('check'); //obtener el valor del arreglo de checks
$cameraVideo=$request->input('check');
//dd($cameraVideo);
for($i=0; $i<5; $i++){
dd($cameraVideo[$i]);
//echo(i);
//$data['id_componente']=$request->get('5');
//$data['no_orden']=$request->get('no_orden');
//$data['disponibilidad']=$request->input('check');
//$data['descripcion']=$request->get('descripcion');
// $query_insert = DB::table('componente')->insert($data);
/* if( $cameraVideo){
dd(true);
var_dump($cameraVideo);
}
else{
dd('no marcadoss');
}*/
// $i++;
}
return Redirect::to('hojatrabajo');
}
here part of my view enter image description here Other problem its amm 1 checkbox its equal to insert in database, please i need your help, thanks for reading me đ
Aucun commentaire:
Enregistrer un commentaire