Reputation: 1
I use laratrust as my user role, in the user role there are 1 = superadministrator, 2 = administrator, 3 = perusahaan, then I want to display the names of existing perusahaan in my view, which means calling user = role id 3, then how to call it? I also don't really understand eloquent relationships
Upvotes: -1
Views: 112
Reputation: 621
You need to get users in this way
// This will return the users with 'superadministrator' role.
$users = User::whereRoleIs('superadministrator')->get();
check the documentation
Upvotes: 0