I have a laravel form on blade page which has a select input. I want to add default value for select only if variable $tour->city_from has been passed to the view. I did it like this:
{!!Form::model($tours2, ['action' => 'FormController@store'])!!}
{!! Form::select('сity_from', $cities, (isset($tour->сity_from)) : $tour->сity_from ) !!}
{!!Form::close()!!}
It outputs a mistake: "Parse error: syntax error, unexpected ':', expecting ',' or ')' ".
Maybe I am using a bad syntaxis? Or my approach is wrong?
Thank you in advance!
You should just need to change your select to:
{!! Form::select('сity_from', $cities, isset($tour->сity_from) ? $tour->сity_from : null ) !!}
Hope this helps!