Laravel 5.5使用artesaos / defender

时间:2017-09-23 17:15:48

标签: php mysql symfony laravel-5 roles

我正在使用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());

1 个答案:

答案 0 :(得分:0)

Muzafar Ali的这个解决方案为我工作:

我通过替换github.com/artesaos/defender/blob/master/src/Defender/Traits/…

找到了解决方案

return PermissionUserPivot::fromRawAttributes($parent, $attributes, $table, $exists, $using);