diff --git a/src/Resources/RoleResource.php b/src/Resources/RoleResource.php index df217aa..dc30ed8 100644 --- a/src/Resources/RoleResource.php +++ b/src/Resources/RoleResource.php @@ -327,13 +327,14 @@ public static function experimentalGetEntityPermissions(array $entity): array public static function experimentalSetEntityStateWhenRecordHasPermission(Component $component, Model $record, array $entity) { - if (is_null($record)) { + if (blank($record)) { return; } $component->state( collect(static::experimentalGetEntityPermissions($entity)) ->reduce(function ($permissions, $value, $key) use($record) { + /** @phpstan-ignore-next-line */ if ($record->checkPermissionTo($key)) { $permissions[] = $key; } @@ -388,12 +389,13 @@ public static function experimentalGetWidgetPermissions(): array public static function experimentalSetWidgetsStateWhenRecordHasPermission(Component $component, Model $record) { - if (is_null($record)) { + if (blank($record)) { return; } $component->state( collect(static::experimentalGetWidgetPermissions()) + /** @phpstan-ignore-next-line */ ->filter(fn($value, $key) => $record->checkPermissionTo($key)) ->keys() ->toArray() @@ -411,12 +413,13 @@ public static function experimentalGetPagePermissions(): array public static function experimentalSetPagesStateWhenRecordHasPermission(Component $component, Model $record) { - if (is_null($record)) { + if (blank($record)) { return; } $component->state( collect(static::experimentalGetPagePermissions()) + /** @phpstan-ignore-next-line */ ->filter(fn($value, $key) => $record->checkPermissionTo($key)) ->keys() ->toArray() @@ -434,12 +437,13 @@ public static function experimentalGetCustomPermissions(): array public static function experimentalSetCustomPermissionsStateWhenRecordHasPermission(Component $component, Model $record) { - if (is_null($record)) { + if (blank($record)) { return; } $component->state( collect(static::experimentalGetCustomPermissions()) + /** @phpstan-ignore-next-line */ ->filter(fn($value, $key) => $record->checkPermissionTo($key)) ->keys() ->toArray()