2017-09-23 54 views
1

我使用laravel 5.5 *并安装此https://github.com/artesaos/defender包的角色和权限,所有的东西工作正常,但是当我试图获得许可Laravel 5.5使用artesaos /后卫

$permissions = array_map(function ($permission) { 
     return $permission['name']; 
    }, $user->getAllPermissions()->toArray()); 

得到打击错误:

"Symfony\Component\Debug\Exception\FatalThrowableError" file : H:\xampp\htdocs\LaraVueAdmin\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php" line: 147 message : "Type error: Argument 1 passed to Illuminate\Database\Eloquent\Model::__construct() must be of the type array, object given, called in H:\xampp\htdocs\LaraVueAdmin\vendor\artesaos\defender\src\Defender\Traits\Models\Permission.php on line 75"

+0

我通过更换https://github.com/artesaos/defender/blob/master/src/Defender/Traits/Models/Permission.php:75 找到溶液与 '返回PermissionUserPivot :: fromRawAttributes($ parent,$ attributes,$ table,$ exists,$ using);' –

回答

0

Muzafar阿里的这种解决方案,为我工作:

我找到了解决办法通过更换github.com/artesaos/defender/blob/master/src/Defender/Traits/…

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

+0

这不提供问题的答案。一旦你有足够的[声誉](https://stackoverflow.com/help/whats-reputation),你将可以[对任何帖子发表评论](https://stackoverflow.com/help/privileges/comment);相反,[提供不需要提问者澄清的答案](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-c​​an- I-DO-代替)。 - [来自评论](/ review/low-quality-posts/18683192) –