问题
I have a problem with Laravel collective select placeholder not working
{{ Form::select('album',$albums,$selected, ['class'=>'form-control','placeholder'=>'select album' ]) }}
But when i allow tags to true like this using select 2, it works fine,
{{ Form::select('tags[]',$tags,$tagged, ['data-input'=>'select2-tags','multiple'=>true]) }}
The second one works fine, I don't want the album to have multiple input attribute, What am i doing wrong?
回答1:
You can do this with select
, but you can add placeholder as the value with 0
index:
$albums[0] = 'select album';
Alternatively, you can create your own select function using Laravel Collective Form macros.
回答2:
You can follow this :
{{ Form::select('album', $album , Input::old('album'), array('placeholder' => 'Please select','class'=>'form-control')) }}
来源:https://stackoverflow.com/questions/43569986/laravel-collective-select-placeholder-not-working-when-multiple-is-to-true-fo