From 48280f36bb0d01f22504d2b0f6ebdbb06cf62198 Mon Sep 17 00:00:00 2001 From: atmonshi Date: Sun, 6 Aug 2023 23:30:04 +0000 Subject: [PATCH] Fix styling --- src/Filament/Resources/PageResource.php | 14 +++++++------- src/Filament/Resources/PostResource.php | 20 ++++++++++---------- src/Filament/Resources/TagResource.php | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Filament/Resources/PageResource.php b/src/Filament/Resources/PageResource.php index 8d43a67..ef8cbfe 100644 --- a/src/Filament/Resources/PageResource.php +++ b/src/Filament/Resources/PageResource.php @@ -89,7 +89,7 @@ public static function form(Form $form): Form ->hint(__('Write an excerpt for your post')), TextInput::make('slug') - ->unique(ignorable: fn(?Post $record): ?Post => $record) + ->unique(ignorable: fn (?Post $record): ?Post => $record) ->required() ->maxLength(255) ->label(__('Post Slug')), @@ -116,7 +116,7 @@ public static function form(Form $form): Form TextInput::make('password') ->label(__('Password')) - ->visible(fn(Get $get): bool => $get('status') === 'private'), + ->visible(fn (Get $get): bool => $get('status') === 'private'), DateTimePicker::make('published_at') ->label(__('published at')) @@ -140,11 +140,11 @@ public static function form(Form $form): Form ->inline(), SpatieMediaLibraryFileUpload::make('featured_image_upload') ->collection('pages') - ->visible(fn(Get $get) => $get('featured_image_type') === 'upload') + ->visible(fn (Get $get) => $get('featured_image_type') === 'upload') ->label(''), TextInput::make('featured_image') ->label(__('featured image url')) - ->visible(fn(Get $get) => $get('featured_image_type') === 'url') + ->visible(fn (Get $get) => $get('featured_image_type') === 'url') ->url(), ]), ])->columnSpan(2), @@ -168,7 +168,7 @@ public static function table(Table $table): Table ->searchable(['status']) ->toggleable() ->view('zeus::filament.columns.status-desc') - ->tooltip(fn(Post $record): string => $record->published_at->format('Y/m/d | H:i A')), + ->tooltip(fn (Post $record): string => $record->published_at->format('Y/m/d | H:i A')), ]) ->defaultSort('id', 'desc') ->actions([ @@ -178,7 +178,7 @@ public static function table(Table $table): Table ->color('warning') ->icon('heroicon-o-arrow-top-right-on-square') ->label(__('Open')) - ->url(fn(Post $record): string => route('page', ['slug' => $record])) + ->url(fn (Post $record): string => route('page', ['slug' => $record])) ->openUrlInNewTab(), DeleteAction::make('delete'), ForceDeleteAction::make(), @@ -198,7 +198,7 @@ public static function table(Table $table): Table ->options(SkyPlugin::get()->getPostStatusModel()::pluck('label', 'name')), Filter::make('password') ->label(__('Password Protected')) - ->query(fn(Builder $query): Builder => $query->whereNotNull('password')), + ->query(fn (Builder $query): Builder => $query->whereNotNull('password')), ]); } diff --git a/src/Filament/Resources/PostResource.php b/src/Filament/Resources/PostResource.php index 9758c3c..2017da8 100644 --- a/src/Filament/Resources/PostResource.php +++ b/src/Filament/Resources/PostResource.php @@ -85,7 +85,7 @@ public static function form(Form $form): Form ->hint(__('Write an excerpt for your post')), TextInput::make('slug') - ->unique(ignorable: fn(?Post $record): ?Post => $record) + ->unique(ignorable: fn (?Post $record): ?Post => $record) ->required() ->maxLength(255) ->label(__('Post Slug')), @@ -112,7 +112,7 @@ public static function form(Form $form): Form TextInput::make('password') ->label(__('Password')) - ->visible(fn(Get $get): bool => $get('status') === 'private'), + ->visible(fn (Get $get): bool => $get('status') === 'private'), DateTimePicker::make('published_at') ->label(__('published at')) @@ -143,12 +143,12 @@ public static function form(Form $form): Form SpatieMediaLibraryFileUpload::make('featured_image_upload') ->collection('posts') - ->visible(fn(Get $get) => $get('featured_image_type') === 'upload') + ->visible(fn (Get $get) => $get('featured_image_type') === 'upload') ->label(''), TextInput::make('featured_image') ->label(__('featured image url')) - ->visible(fn(Get $get) => $get('featured_image_type') === 'url') + ->visible(fn (Get $get) => $get('featured_image_type') === 'url') ->url(), ]), ])->columnSpan(2), @@ -172,7 +172,7 @@ public static function table(Table $table): Table ->searchable(['status']) ->toggleable() ->view('zeus::filament.columns.status-desc') - ->tooltip(fn(Post $record): string => $record->published_at->format('Y/m/d | H:i A')), + ->tooltip(fn (Post $record): string => $record->published_at->format('Y/m/d | H:i A')), SpatieTagsColumn::make('tags') ->label(__('Post Tags')) @@ -192,7 +192,7 @@ public static function table(Table $table): Table ->color('warning') ->icon('heroicon-o-arrow-top-right-on-square') ->label(__('Open')) - ->url(fn(Post $record): string => route('post', ['slug' => $record])) + ->url(fn (Post $record): string => route('post', ['slug' => $record])) ->openUrlInNewTab(), DeleteAction::make('delete'), ForceDeleteAction::make(), @@ -213,17 +213,17 @@ public static function table(Table $table): Table Filter::make('password') ->label(__('Password Protected')) - ->query(fn(Builder $query): Builder => $query->whereNotNull('password')), + ->query(fn (Builder $query): Builder => $query->whereNotNull('password')), Filter::make('sticky') ->label(__('Still Sticky')) // @phpstan-ignore-next-line - ->query(fn(Builder $query): Builder => $query->sticky()), + ->query(fn (Builder $query): Builder => $query->sticky()), Filter::make('not_sticky') ->label(__('Not Sticky')) ->query( - fn(Builder $query): Builder => $query + fn (Builder $query): Builder => $query ->whereDate('sticky_until', '<=', now()) ->orWhereNull('sticky_until') ), @@ -231,7 +231,7 @@ public static function table(Table $table): Table Filter::make('sticky_only') ->label(__('Sticky Only')) ->query( - fn(Builder $query): Builder => $query + fn (Builder $query): Builder => $query ->where('post_type', 'post') ->whereNotNull('sticky_until') ), diff --git a/src/Filament/Resources/TagResource.php b/src/Filament/Resources/TagResource.php index c613dae..f196ac1 100644 --- a/src/Filament/Resources/TagResource.php +++ b/src/Filament/Resources/TagResource.php @@ -43,7 +43,7 @@ public static function form(Form $form): Form $set('slug', Str::slug($state)); }), TextInput::make('slug') - ->unique(ignorable: fn(?Model $record): ?Model => $record) + ->unique(ignorable: fn (?Model $record): ?Model => $record) ->required() ->maxLength(255), Select::make('type') @@ -61,7 +61,7 @@ public static function table(Table $table): Table TextColumn::make('items_count') ->toggleable() ->getStateUsing( - fn(Tag $record): int => method_exists($record, $record->type) + fn (Tag $record): int => method_exists($record, $record->type) ? $record->{$record->type}()->count() : 0 ),