How set null to first option in Laravel 5 blade

2019-08-05 17:56发布

here is laravel blade selectyears which generates select from 2013 to 2015 and need set first option to null.

{!! Form::selectYear('year', 2013, 2015) !!}

1条回答
Viruses.
2楼-- · 2019-08-05 18:19

Just have another array array(''=>"Select Year") in your select

I guess that you need null because you might need to place some text like Select Year like that.

Here is What you need

{!! Form::select('year', range(2013, 2015) + array(''=>"Select Year")) !!}
查看更多
登录 后发表回答