【发布时间】:2019-10-14 03:12:00
【问题描述】:
在我的新 Laravel 5.8 应用程序中,我阅读了下一篇文章以使用带有 jwt 扩展的角色: https://scotch.io/tutorials/role-based-authentication-in-laravel-with-jwt 在种子中我添加了几个角色,比如:
\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',
),
));
当我需要为用户分配一些角色时,我看到了 assignRole 方法。 我不清楚权限和“permission_role”数据是什么。 我的简单应用程序结构是否需要它们?如果是,请提供一些例子...
谢谢!
【问题讨论】:
标签: laravel-5 user-roles