Laravel 5.3 – Call to undefined method IlluminateDatabaseQueryBuilder::lists() Solved

Laravel 5.3 – Call to undefined method IlluminateDatabaseQueryBuilder::lists() Solved

In this post we will give you information about Laravel 5.3 – Call to undefined method IlluminateDatabaseQueryBuilder::lists() Solved. Hear we will give you detail about Laravel 5.3 – Call to undefined method IlluminateDatabaseQueryBuilder::lists() SolvedAnd how to use it also give you demo for it if it is necessary.

Today i want to tell you about error “Call to undefined method IlluminateDatabaseQueryBuilder::lists()” and how to solve this error in Laravel 5.3.

When i was working on my Laravel 5.3 application, at that time i require to get lists of email and id of users table for select drop-down. But when i use lists() with DB table i found error “Call to undefined method IlluminateDatabaseQueryBuilder::lists()”.

Error was like bellow preview:

BadMethodCallException in Builder.php line 2440: Call to undefined method


IlluminateDatabaseQueryBuilder::lists()

I did search a lot on docs and google, But finally i found i think Laravel 5.3 removed lists() on query builder.

But i found solution of this method using

pluck(). So you can solve your solution like as bellow:

Not Working:

$users = DB::table("users")->lists("email","id");

dd($users);

Working Example:

Also see:How to make simple dependent dropdown using jquery ajax in Laravel 5?

$users = DB::table("users")->pluck("email","id")->all();

dd($users);

Maybe it can help you…..

Hope this code and post will helped you for implement Laravel 5.3 – Call to undefined method IlluminateDatabaseQueryBuilder::lists() Solved. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

4  +  6  =  

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US