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.

I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets. Protection Status