Laravel – Dropdowns with Collection’s Lists method

The Collection class in Laravel is really awesome. In Laravel, Eloquent returns result in the collection object. The class contains a lot of handy methods that will make your work so much easier. In this post I would like to write about List() method and I show you , how I used list method to generate HTML dropdown with laravel form collective .

list() method will return every value of a given key. The following example returns every category’s title, indexed by their category id.

Generating A Drop-Down List

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
DMCA.com Protection Status
0
Would love your thoughts, please comment.x
()
x