我使用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"
我通過更換https://github.com/artesaos/defender/blob/master/src/Defender/Traits/Models/Permission.php:75 找到溶液與 '返回PermissionUserPivot :: fromRawAttributes($ parent,$ attributes,$ table,$ exists,$ using);' –