我正在使用laravel 5.5。*并安装此https://github.com/artesaos/defender软件包以获取角色和权限,所有工作正常,但是当我尝试获得权限时
$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"
最佳答案
Muzafar Ali的以下解决方案为我工作:
我通过替换github.com/artesaos/defender/blob/master/src/Defender/Traits/…
找到了解决方案
与return PermissionUserPivot::fromRawAttributes($parent, $attributes, $table, $exists, $using);
关于php - Laravel 5.5使用artesaos/defender,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46382239/