Laravel: How to pass database values to the form-builder dropdown
I use this in the controller file:
$languages = Language::lists('language_name', 'id');
$this->layout->content = View::make('content.create', compact('languages'));
...and in the view file:
{{ Form::select('language', $languages) }}
...and that, ladies and gentlemen, should work.
Written by byjml
Related protips
2 Responses

Where in the controller will I put the code and in what controller?
over 1 year ago
·

Hi @itspecialist,
Depends on your controller. It's usually inside the method you use to display form views, e.g. create()
or edit()
methods of your resourceful controllers.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Laravel
Authors
Related Tags
#laravel
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#