mardi 28 mai 2019

Using roles with jwt / zizaco/entrust

In my new Laravel 5.8 app I read next article to use roles with jwt extention : https://scotch.io/tutorials/role-based-authentication-in-laravel-with-jwt and in seed I add several roles, like :

\DB::table('roles')->insert(array (
    0 =>
        array (
            'id' => 1,
            'name' => 'Admin',
            'display_name' => 'Admin',
            'description' => 'Administrator. Can do all operations in system',
            'created_at' => '2019-04-29 11:03:50',
        ),
    1 =>
        array (
            'id' => 2,
            'name' => 'Manager',
            'display_name' => 'Manager. Can do all operations in frontend and CRUD for Hostels/CMS items in Backend',                         
            'description' => 'Manager description...',
            'created_at' => '2019-04-29 11:03:50',
        ),
    2 =>
        array (
            'id' => 3,
            'name' => 'Customer',
            'display_name' => 'Customer. Can do all operations in frontend',
            'description' => 'Customer description...',
            'created_at' => '2019-04-29 11:03:50',
        ),
));

and I see assignRole method, when I need to assign some role to user. What is unclear for me what for Permissions and “permission_role” data. Do I need them for my simple app structure? If yes, please provide some examples...

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire