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: https://laravel.com/api/5.2/Illuminate/Database/Query/Builder.... 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!
We'd like to thank these amazing companies for supporting us
The Laravel portal for problem solving, knowledge sharing and community building.