Laravel-permission: List all roles?

Created on 1 Aug 2017  路  4Comments  路  Source: spatie/laravel-permission

Am i missing something?
Why there's no mention of this in docs.

The functionality to list roles in order to apply one to the user is something so obvious that i suspect there must be a reason not to provide it.

Most helpful comment

Hi,
Please check the code below to see if the help.

Get all roles:
$roles = \Spatie\Permission\Models\Role::all();

Get all users with relations:
$users = \App\User::with('roles')->get();

All 4 comments

Hi,
Please check the code below to see if the help.

Get all roles:
$roles = \Spatie\Permission\Models\Role::all();

Get all users with relations:
$users = \App\User::with('roles')->get();

Thank for answering this one @pmestre-pt 馃憤

Thanks a lot :dancer:

use App\Role;

Role::get();
coz Role model already extends \Spatie\Permission\Models\Role

Was this page helpful?
0 / 5 - 0 ratings

Related issues

younus93 picture younus93  路  4Comments

feliperoan picture feliperoan  路  3Comments

ionesculiviucristian picture ionesculiviucristian  路  4Comments

hosseinnedaei picture hosseinnedaei  路  3Comments

NattananWs picture NattananWs  路  3Comments