将选择选项显示为默认值

时间:2017-11-01 13:17:47

标签: laravel laravel-5 laravel-5.3

我laravel我想创建一个想要有'select option,Approved,Rejected'的选择框但是我总是在表单中显示已批准为默认选项

echo Form::select('request_status',[''=>'Select option','4'=>'Approved','7'=>'Rejected'],null,['class'=>'request_status report_filter default']);

如何在laravel 5.3

中将选项作为默认选项

1 个答案:

答案 0 :(得分:1)

Form::select中的第三个参数是所选项目:

Form::select('request_status',[''=>'Select option','4'=>'Approved','7'=>'Rejected'],null,['class'=>'request_status report_filter default']);

Approved应为4:

Form::select('request_status',[''=>'Select option','4'=>'Approved','7'=>'Rejected'],4,['class'=>'request_status report_filter default']);

或者如果你想要do it manualy