Support the ongoing development of Laravel.io →
Views Blade Forms
Last updated 1 year ago.
0

Documentation for dropdown is provided @ http://laravel.com/docs/4.2/html#drop-down-lists

You are already passing the data to the view. In your view/blade file, you can do something like this


Form::select('name', $Dropdown );

Last updated 1 year ago.
0

The problem with this is that, the select parameter expects a string. What i'll be passing on to it as per your suggestion will be an object.

Last updated 1 year ago.
0

Nope. Select statement accepts array as second argument. Since query builder returns the value as object, you have to remap to array before passing it select.


$filter = DB::select(DB::raw('SELECT DISTINCT filter AS filt FROM filter.database'));

foreach ($filter as $key => $value) { 
  $dropdown[$key] = $value->filt; 
}

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Tony-254 tony-254 Joined 10 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.