[英]spatie error : PermissionServiceProvider Not Loaded (Laravel Permissions)
i am using Laravel Permission By spatie.我正在使用来自 spatie 的Laravel 权限。 i had done same as provided in document for using Laravel permissions.
我已经完成了与使用 Laravel 权限的文档中提供的相同的操作。
In app.php
i had added the Spatie\Permission\PermissionServiceProvider::class,
at bottom of the array在
app.php
Spatie\Permission\PermissionServiceProvider::class,
and done all things that mentioned in the documentation.my laravel version is 7.x
并完成了文档中提到的所有事情。我的 laravel 版本是
7.x
//My Route.php
Route::get('/createRole',function(){
$role = Role::find(1);
$permission = Permission::find(1);
$role->givePermissionTo($permission);
return "Roles Added Success";
});
And my O/P Says我的 O/P 说
Class 'Role' not found
Class '角色' 未找到
This because actual provider name is "Spatie\Permission\PermissionServiceProvider".这是因为实际的提供者名称是“Spatie\Permission\PermissionServiceProvider”。 Also, generally, you don't need register it manually, only if you disable automate package discovery.
此外,一般情况下,您不需要手动注册它,仅当您禁用自动 package 发现时。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.