【发布时间】:2023-04-01 07:23:01
【问题描述】:
我目前是 Laravel 的新手,正在努力学习它。我现在用它工作了很多小时,并尝试从https://github.com/mateusjunges/laravel-acl 安装和使用 Laravel ACL 但我不断收到错误。
我的步骤:
- 已安装
- 试过
php artisan migrate-> 没用 ->Nothing to migrate. - 手动尝试->将迁移文件从
vendor>mateusjunges>laravel-acl>database>migrations>复制到..database>migrations - 再次
php artisan migrate-> 工作 - 试过
php artisan permission:create testperm testperm "test"->错误
错误:
Call to undefined method Illuminate\Foundation\Application::where()
at testproject\vendor\mateusjunges\laravel-acl\src\Console\Commands\CreatePermission.php:43
39▕ public function handle()
40▕ {
41▕ $permissionModel = app(config('acl.models.permission'));
42▕
➜ 43▕ $permission = $permissionModel->where('slug', $this->argument('slug'))
44▕ ->orWhere('name', $this->argument('name'))
45▕ ->first();
46▕
47▕ if (! is_null($permission)) {
1 testproject\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36
Junges\ACL\Console\Commands\CreatePermission::handle()
2 testproject\vendor\laravel\framework\src\Illuminate\Container\Util.php:40
Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
- 试过
php artisan user:permissions 1-> 下一个错误
错误:
Call to undefined method Illuminate\Foundation\Application::find()
at testproject\vendor\mateusjunges\laravel-acl\src\Console\Commands\UserPermissions.php:44
40▕ $userParameter = $this->argument('user');
41▕ $userModel = app(config('acl.models.user'));
42▕
43▕ if (is_numeric($userParameter)) {
➜ 44▕ $user = $userModel->find((int) $userParameter);
45▕ } elseif (is_string($userParameter)) {
46▕ $table = config('acl.tables.users');
47▕ $columns = $this->verifyColumns($table);
48▕
1 testproject\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36
Junges\ACL\Console\Commands\UserPermissions::handle()
2 testproject\vendor\laravel\framework\src\Illuminate\Container\Util.php:40
Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
不知道自己做错了什么,安装成功了……
【问题讨论】: