You can use the query builder's "lists" method (available for Eloquent as any query builder method) which returns an associative array you can pass to the Form::select method.
like this:
$categories = Category::lists('title', 'id');
note that the parameters you pass to lists correspond to the columns for the value and id, respectively
in this case, "title" and "id"
you should pass this data to your view or somewhere in your view
{{ Form::select('category', $categories) }}then build the dropdown inside it.
Easy guys :) .
No comments:
Post a Comment