Support the ongoing development of →
Requests Database Eloquent
Last updated 2 years ago.

Try using pluck instead of lists. If I remember correctly I think that the lists method was deprecated.


Check here the API of Laravel 5.2: There exists a lists method but like it says, it is an alias of pluck, so please try to use pluck instead, maybe it was removed and the API documentation is not updated.

Hope it works.


mengidd, JuanDMeGon, thanks a lot for help, pluck method works!


I am facing the same problem, I tried using pluck instead of lists, But, I don't know how to change this :

    $roles = Role::pluck('display_name','id');
    $userRole = $user->roles->lists('id','id')->toArray();

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.