In this post, i will tell you how to resolve error "Call to undefined method Illuminate\Database\Query\Builder::lists()" in Laravel 5.3.
I suggest you to see the Deprecations lists on Laravel's official website before going with Laravel 5.3 because some of feature were deprecated in 5.2 but now it is removed in 5.3
I also found this issue with lists() method in Laravel 5.3 while i was showing categories in select dropdown field.
Error you will get when you use lists() method :
BadMethodCallException in Builder.php line 2437: Call to undefined method Illuminate\Database\Query\Builder::lists()
lists
method on the collection in Laravel 5.3 has been renamed to pluck
.
- $list=Category::pluck('name','id');
- $list = \DB::table("categories")->pluck("name","id");