Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method lists does not exist

enter image description hereI am trying to populate my select box from DB with this approach

{!! Form::select('worktypes', $worktypes->lists('name'), null, ['class' => 'col-md-2 form-control', 'required', 'placeholder' => '--auswählen']) !!}

But method lists() doesn't exist anymore in Laravel 5.3

Is there some other method for this?

like image 257
lewis4u Avatar asked Oct 27 '16 08:10

lewis4u


1 Answers

I just found out:

Method lists() is deprecated in Laravel v5.2^

It is renamed to:

pluck()

The method signature remains the same.

Laravel Documentation

search for Deprecations on that link


Update: just in case that link ever dies or page changes, this is what was on it:

Deprecations The following features are deprecated in 5.2 and will be removed in the 5.3 release in June 2016:

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

like image 89
lewis4u Avatar answered Oct 22 '22 10:10

lewis4u