I would like to know if it is possible to add an inline if statement in Laravel's form select element
I am able to do it this way:
<select>
<option value="1">One</option>
<option value="2">Two</option>
{!! $variable=='Hello'?'<option value="3">Three</option>':'' !!}
</select>
But I would like to know if there is a way similar to this:
{!! Form::select('action',array('1'=>'One','2'=>'Two',@if($variable=='Hello') '3'=>'three' @endif),null,['class'=>'form-control']) !!}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire