版本 Laravel 5.4
我把users 表 换成 admins 表了 其他都没变
在Admin model 中 下面方法 的 $this->roles 报错了!
public function hasRole($role) {
if(is_string($role)){
return $this->roles->contains('name', $role);
}
return !! $role->intersect($this->roles)->count();
}
这个是什么问题
Whoops, looks like something went wrong.
(2/2) QueryException
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'redis.admin_role' doesn't exist (SQL: select `roles`.*, `admin_role`.`admin_id` as `pivot_admin_id`, `admin_role`.`role_id` as `pivot_role_id` from `roles` inner join `admin_role` on `roles`.`id` = `admin_role`.`role_id` where `admin_role`.`admin_id` = 1)
为什么是 redis.admin_role 而不是 redis.role_admin