Skip to content

Commit

Permalink
Lint files
Browse files Browse the repository at this point in the history
  • Loading branch information
chiiya authored and github-actions[bot] committed Sep 26, 2023
1 parent 787553c commit c9bcf0e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Commands/CreateFilamentUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function handle(): int
'email' => text(
label: 'Email address',
required: true,
validate: fn (string $email): ?string => match (true) {
validate: static fn (string $email): ?string => match (true) {
! filter_var($email, FILTER_VALIDATE_EMAIL) => 'The email address must be valid.',
static::getUserModel()::query()->where(
'email',
Expand Down
8 changes: 4 additions & 4 deletions src/Fields/PermissionGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ protected function setUp(): void
// https://github.com/laravel-filament/filament/issues/1111
$relatedModels
->pluck($relationship->getRelatedKeyName())
->map(fn ($key): string => (string) $key)
->map(static fn ($key): string => (string) $key)
->toArray(),
);
});

$this->saveRelationshipsUsing(function (self $component, ?array $state): void {
$this->saveRelationshipsUsing(static function (self $component, ?array $state): void {
$component->getRelationship()->sync($state ?? []);
});

$this->options(
fn () => Permission::query()
static fn () => Permission::query()
->where('guard_name', 'filament')
->pluck('name', 'id')
->map(fn (string $name) => __($name))
->map(static fn (string $name) => __($name))
->all(),
);

Expand Down
6 changes: 3 additions & 3 deletions src/Fields/RoleSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ protected function setUp(): void

$this->relationship = 'roles';

$this->afterStateHydrated(function (self $component): void {
$this->afterStateHydrated(static function (self $component): void {
$relationship = $component->getRelationship();

$role = $relationship->first();
Expand All @@ -28,10 +28,10 @@ protected function setUp(): void
$model = config('permission.models.role');

$this->options(
fn () => $model::query()
static fn () => $model::query()
->where('guard_name', 'filament')
->pluck('name', 'id')
->map(fn (string $name) => __($name))
->map(static fn (string $name) => __($name))
->all(),
);

Expand Down
2 changes: 1 addition & 1 deletion src/Notifications/TwoFactorCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function toMail(mixed $notifiable): MailMessage
*/
protected function generateTwoFactorCode(): string
{
return implode('', array_map(fn () => random_int(0, 9), range(1, 6)));
return implode('', array_map(static fn () => random_int(0, 9), range(1, 6)));
}

/**
Expand Down
14 changes: 7 additions & 7 deletions src/Resources/FilamentUserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function form(Form $form): Form
->schema([
Grid::make()
->schema(
fn (Component $livewire) => $livewire instanceof ViewFilamentUser
static fn (Component $livewire) => $livewire instanceof ViewFilamentUser
? [
...static::insertBeforeFormSchema(),
static::detailsSection(),
Expand All @@ -55,7 +55,7 @@ public static function form(Form $form): Form
__('filament-access-control::default.fields.permissions'),
)
->resolveStateUsing(
fn ($record) => $record->getAllPermissions()->pluck('id')->all(),
static fn ($record) => $record->getAllPermissions()->pluck('id')->all(),
),
]),
...static::insertAfterFormSchema(),
Expand Down Expand Up @@ -91,14 +91,14 @@ public static function table(Table $table): Table
->searchable(),
TextColumn::make('role')
->label(__('filament-access-control::default.fields.role'))
->getStateUsing(fn ($record) => __(optional($record->roles->first())->name)),
->getStateUsing(static fn ($record) => __(optional($record->roles->first())->name)),
...(
Feature::enabled(Feature::ACCOUNT_EXPIRY)
? [
IconColumn::make('active')
->boolean()
->label(__('filament-access-control::default.fields.active'))
->getStateUsing(fn (AccessControlUser $record) => ! $record->isExpired()),
->getStateUsing(static fn (AccessControlUser $record) => ! $record->isExpired()),
]
: []
),
Expand Down Expand Up @@ -130,7 +130,7 @@ public static function table(Table $table): Table
? [
Filter::make(__('filament-access-control::default.filters.expired'))
->query(
fn (Builder $query) => $query->whereNotNull(
static fn (Builder $query) => $query->whereNotNull(
'expires_at',
)->where('expires_at', '<=', now()),
),
Expand Down Expand Up @@ -200,10 +200,10 @@ protected static function detailsSectionSchema(): array
DatePicker::make('expires_at')
->label(__('filament-access-control::default.fields.expires_at'))
->validationAttribute(__('filament-access-control::default.fields.expires_at'))
->minDate(fn (Component $livewire) => static::evaluateMinDate($livewire))
->minDate(static fn (Component $livewire) => static::evaluateMinDate($livewire))
->displayFormat(config('filament-access-control.date_format'))
->dehydrateStateUsing(
fn ($state) => Carbon::parse($state)->endOfDay()->toDateTimeString(),
static fn ($state) => Carbon::parse($state)->endOfDay()->toDateTimeString(),
),
]
: []
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/PermissionResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function form(Form $form): Form
->unique(
config('permission.table_names.permissions'),
'name',
fn (?Permission $record): ?Permission => $record,
static fn (?Permission $record): ?Permission => $record,
),
...static::insertAfterFormSchema(),
]);
Expand All @@ -57,7 +57,7 @@ public static function table(Table $table): Table
->sortable(),
TextColumn::make('description')
->label(__('filament-access-control::default.fields.description'))
->getStateUsing(fn (Permission $record) => __($record->name)),
->getStateUsing(static fn (Permission $record) => __($record->name)),
TextColumn::make('name')
->label(__('filament-access-control::default.fields.name'))
->searchable(),
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/RoleResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function form(Form $form): Form
->validationAttribute(__('filament-access-control::default.fields.name'))
->required()
->maxLength(255)
->unique(config('permission.table_names.roles'), 'name', fn ($record) => $record),
->unique(config('permission.table_names.roles'), 'name', static fn ($record) => $record),
PermissionGroup::make('permissions')
->label(__('filament-access-control::default.fields.permissions'))
->validationAttribute(__('filament-access-control::default.fields.permissions')),
Expand All @@ -56,7 +56,7 @@ public static function table(Table $table): Table
->sortable(),
TextColumn::make('description')
->label(__('filament-access-control::default.fields.description'))
->getStateUsing(fn ($record) => __($record->name)),
->getStateUsing(static fn ($record) => __($record->name)),
TextColumn::make('name')
->label(__('filament-access-control::default.fields.name'))
->searchable(),
Expand Down

0 comments on commit c9bcf0e

Please sign in to comment.