Call to undefined method Illuminate\Database\Query\Builder::lists() when seeding after updating to Laravel 5.3 Call to undefined method Illuminate\Database\Query\Builder::lists() when seeding after updating to Laravel 5.3 laravel laravel

Call to undefined method Illuminate\Database\Query\Builder::lists() when seeding after updating to Laravel 5.3


You can use method pluck. Method lists is removed in Laravel 5.3.I changed lists('key')->all() to pluck('key')->all() and it's working now.


Laravel 5.3, the lists() method is removed in favour of the pluck() method. For Example:

$userList = App\User::pluck('name', 'id');


lists() was deprecated. Use pluck() instead.

The lists method on the Collection, query builder and Eloquent query builder objects has been renamed to pluck. The method signature remains the same.

https://laravel.com/docs/5.3/upgrade#upgrade-5.3.0