dimanche 3 janvier 2016

Laravel Blade Shorthand Ternary Operator not working

I am using laravel collective to generate my forms and in one of the dropdown I have the following ternary operator which works:

 {!! Form::select('department_id', ['' => 'Please select'] + $departments, isset($user->departmentStaff->department_id) ? $user->departmentStaff->department_id : null , ['class' => 'form-control']) !!}

However the laravel shorthand ternary operator doesn't work, it throws an error:

{!! Form::select('department_id', ['' => 'Please select'] + $departments, $user->departmentStaff->department_id or null , ['class' => 'form-control']) !!}

This is from the official docs: http://ift.tt/1OCTkhg



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire