Laravel 5.3 - Call to undefined method Illuminate\Database\Query\Builder::lists()

Laravel 5.3 - Call to undefined method Illuminate\Database\Query\Builder::lists()

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.

Using Eloquent :
  1. $list=Category::pluck('name','id');
Using DB Query Builder :
  1. $list = \DB::table("categories")->pluck("name","id");

Phone: (+91) 8800417876
Noida, 201301
ataşehir escort maltepe escort bostancı escort kadıköy escort maltepe escort ataşehir escort kurtköy escort kartal escort pendik escort ataşehir escort
şişli escort
pendik escort
izmir escort izmir escort izmir escort izmir escort denizli escort antalya escort antalya escort antalya escort izmir escort izmir escort izmir escort izmir escort izmir escort