你能给我建议该怎么做。我正在关注本教程: Laravel 5.6 - 使用 Spatie 教程的用户角色和权限(ACL)
都好。但最后,我只能访问users
页面并且无法创建新用户,因为列表中没有角色。在页面中 -products
并roles
从处理程序给我一条消息:["User have not permission for this page access."]
我只有许可种子:
<?php
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission;
class PermissionTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$permissions = [
'role-list',
'role-create',
'role-edit',
'role-delete',
'product-list',
'product-create',
'product-edit',
'product-delete'
];
foreach ($permissions as $permission) {
Permission::create(['name' => $permission]);
}
}
}
如果您希望从项目中获得更多代码,我可以为您提供更多代码。