我正在使用laravel 5.5。*并安装此https://github.com/artesaos/defender包以获得角色和权限,所有工作正常但我尝试获得许可时
def index(conn, _params, user) do
videos = Repo.all(user_videos(user)) |> Repo.preload(:category)
render(conn, "index.html", videos: videos)
end
得到打击错误:
$permissions = array_map(function ($permission) {
return $permission['name'];
}, $user->getAllPermissions()->toArray());
答案 0 :(得分:0)
Muzafar Ali的这个解决方案为我工作:
我通过替换github.com/artesaos/defender/blob/master/src/Defender/Traits/…
带
return PermissionUserPivot::fromRawAttributes($parent, $attributes,
$table, $exists, $using);