mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Update helpers.php
This commit is contained in:
@@ -6,6 +6,7 @@ use Filament\Facades\Filament;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
if (! function_exists('Filament\authorize')) {
|
||||
@@ -17,7 +18,7 @@ if (! function_exists('Filament\authorize')) {
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
if (! $shouldCheckPolicyExistence) {
|
||||
return Gate::forUser($user)->authorize($action, $model);
|
||||
return Gate::forUser($user)->authorize($action, Arr::wrap($model));
|
||||
}
|
||||
|
||||
$policy = Gate::getPolicyFor($model);
|
||||
@@ -44,6 +45,6 @@ if (! function_exists('Filament\authorize')) {
|
||||
return $response->authorize();
|
||||
}
|
||||
|
||||
return Gate::forUser($user)->authorize($action, $model);
|
||||
return Gate::forUser($user)->authorize($action, Arr::wrap($model));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user