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

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

0

Check here the API of Laravel 5.2: https://laravel.com/api/5.2/Illuminate/Database/Query/Builder.html 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.

0

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

0

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();
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.