我正在尝试安装该程序包,以帮助管理我在应用程序中的角色和权限。我一直遇到以下问题。根据文档,要安装 ,请运行此命令spatie/laravel-permissionLaravel permission
composer require spatie/laravel-permission
但是,当我这样做时,我收到此错误:
> @php artisan package:discover --ansi
ErrorException : Trying to access array offset on value of type null
at /home/anto/encomm/projects/vendor/spatie/laravel-permission/src/PermissionServiceProvider.php:61
57| protected function registerModelBindings()
58| {
59| $config = $this->app->config['permission.models'];
60|
> 61| $this->app->bind(PermissionContract::class, $config['permission']);
62| $this->app->bind(RoleContract::class, $config['role']);
63| }
64|
65| protected function registerBladeExtensions()
Exception trace:
1 Illuminate\Foundation\Bootstrap\HandleExceptions::handleError()
/home/anto/encomm/projects/vendor/spatie/laravel-permission/src/PermissionServiceProvider.php:61
2 Spatie\Permission\PermissionServiceProvider::registerModelBindings()
/home/anto/encomm/projects/vendor/spatie/laravel-permission/src/PermissionServiceProvider.php:36
Please use the argument -v to see more details.
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Installation failed, reverting ./composer.json to its original content.
以下是我的文件的内容:composer.json
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.4",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.2",
"laravel/passport": "^8.2",
"laravel/tinker": "^2.0",
"laravel/ui": "^1.1",
"owen-it/laravel-auditing": "^9.3",
"sudiptpa/guid": "^1.0",
"unisharp/laravel-filemanager": "^2.0"
},
翻阅古今