php - 在 laravel 5.6 中找不到 Trait 'App\HasRoles' 错误
问题描述
我正在尝试通过 laravel 5.6 角色权限系统
当我尝试使用默认身份验证(php artisan make:auth)注册时,我收到此错误
“Symfony \ Component \ Debug \ Exception \ FatalErrorException(E_UNKNOWN)特征'App \ HasRoles'未找到”
这是我的模型 user.php
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
use HasRoles;
protected $guard_name = 'web';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
}
解决方案
运行此命令
作曲家安装
推荐阅读
- python-3.x - 如何读取刚刚由python中的函数创建的文件
- python - While 循环在允许 if 语句运行之前要求输入两次
- python-3.x - 为什么 Visual Studio 无法识别已安装的包?
- python - 如何打印 response.content 的特定部分
- xero-api - 如何使用 OAuth 2.0 在 Xero 中生成访问令牌?
- mysql - 使用spring数据jpa和mysql检查两个日期之间的日期
- javascript - 找一个空数组,修改json
- google-cloud-platform - Cloud SDK:gcloud sql 实例描述抛出错误 404:Cloud SQL 实例不存在
- laravel - 如何在多租户 SaaS 应用程序中为每个租户管理不同的队列?
- unit-testing - Resharper 测试窗口显示“已中止”,但所有测试均通过