Dev
Dev

Reputation: 1073

How to fill Form::select more beautiful?

I use the following form:

 <?=Form::select('stars', array(
                            1 => 1,
                            2 => 2,
                            3 => 3,
                            4 => 4,
                            5 => 5
                        ), null, ["placeholder" => "Stars", "class" => "w-select"]);?>

It looks awful. How can I reformate array in Form::select that keys will be from 1 to 5?

Upvotes: 1

Views: 189

Answers (1)

Ravisha Hesh
Ravisha Hesh

Reputation: 1504

Use can use select range instead of select.

{!! Form::selectRange('stars', 1, 5, null, ["placeholder" => "Stars", "class" => "w-select"]) !!}

more details:https://laravelcollective.com/docs/5.1/html#drop-down-lists

Upvotes: 2

Related Questions