Support the ongoing development of Laravel.io →
Requests Database Forms
Last updated 2 years ago.
0

if you want to ouput checked checkbox, pass a third param true

ie:

{{ Form::checkbox('name', 'value', true) }}
Last updated 2 years ago.
0

Explaining on the bench there is a column with name turnos, the type set ('Morning', 'Afternoon', 'Night'). If recorded only 'Morning', 'Afternoon' and the third empty stowage want the edit view returns the three checkbox.

[v] Morning [v] Afternoon [ ] Evening

But returns as well.

<?php	$course = explode(",", $curso->turno);?>	 

	  @foreach ($course as $c)
	  	<label>{{ Form::checkbox('turnos[]', $c, true) }} {{$c}}</label>
	  @endforeach
Last updated 2 years ago.
0

sorry i don't understand you, better try you on Portuguese Stackoverflow

Last updated 2 years ago.
0

If you want to return all check-boxes, including "empty" (not checked) check-boxes, you has to use additional hidden fields.

A better solution is to use name like 'turnos_Manhã', 'turnos_tarde'... Then, in the POST route/controller, to create a turnos[] array with all ids of setted check-boxes, then use the array to synchronise all links in one step:

foreach ($tempos as $tempo) {
   if Input::has('turnos_' . $tempo->name) {
      $turnos[]=$tempo->id;
   }
}
$yourobject->tempos()->sync($turnos);
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

multiarts multiarts Joined 1 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.