diff --git a/resources/views/filament/columns/tag-counts.blade.php b/resources/views/filament/columns/tag-counts.blade.php
deleted file mode 100644
index 2f312b8..0000000
--- a/resources/views/filament/columns/tag-counts.blade.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- {{ method_exists($getRecord(),$getRecord()->type) ? $getRecord()->{$getRecord()->type}()->count() : 0 }}
-
diff --git a/resources/views/themes/zeus/sky/addons/library-item.blade.php b/resources/views/themes/zeus/sky/addons/library-item.blade.php
index ec7b022..9ad17dd 100644
--- a/resources/views/themes/zeus/sky/addons/library-item.blade.php
+++ b/resources/views/themes/zeus/sky/addons/library-item.blade.php
@@ -15,7 +15,7 @@
-
+
{{ $item->title }}
@@ -32,5 +32,5 @@
@include($skyTheme.'.addons.library-types.'.strtolower($item->type))
@endforeach
-
+
diff --git a/resources/views/themes/zeus/sky/addons/library-tag.blade.php b/resources/views/themes/zeus/sky/addons/library-tag.blade.php
index 12b37e0..ddef14d 100644
--- a/resources/views/themes/zeus/sky/addons/library-tag.blade.php
+++ b/resources/views/themes/zeus/sky/addons/library-tag.blade.php
@@ -25,7 +25,7 @@
@foreach($libraryTag->library as $lib)
-
+
-
+
@endforeach
diff --git a/resources/views/themes/zeus/sky/addons/library.blade.php b/resources/views/themes/zeus/sky/addons/library.blade.php
index ad726f5..77cd73a 100644
--- a/resources/views/themes/zeus/sky/addons/library.blade.php
+++ b/resources/views/themes/zeus/sky/addons/library.blade.php
@@ -6,7 +6,7 @@
@foreach($categories as $category)
-
+
@foreach($category->library as $library)
@@ -39,7 +39,7 @@
@endforeach
-
+
@endforeach
diff --git a/resources/views/themes/zeus/sky/partial/password-form.blade.php b/resources/views/themes/zeus/sky/partial/password-form.blade.php
index ecfdeab..7d620c5 100644
--- a/resources/views/themes/zeus/sky/partial/password-form.blade.php
+++ b/resources/views/themes/zeus/sky/partial/password-form.blade.php
@@ -1,5 +1,5 @@
-
+
@csrf
@@ -15,5 +15,5 @@
{{ __('Send') }}
-
+
diff --git a/src/Filament/Resources/PageResource.php b/src/Filament/Resources/PageResource.php
index ef8cbfe..8d43a67 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 2017da8..9758c3c 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 98209f8..c613dae 100644
--- a/src/Filament/Resources/TagResource.php
+++ b/src/Filament/Resources/TagResource.php
@@ -16,6 +16,7 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use LaraZeus\Sky\Filament\Resources\TagResource\Pages;
+use LaraZeus\Sky\Models\Tag;
use LaraZeus\Sky\SkyPlugin;
class TagResource extends SkyResource
@@ -42,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')
@@ -59,7 +60,11 @@ public static function table(Table $table): Table
TextColumn::make('slug')->toggleable()->searchable()->sortable(),
TextColumn::make('items_count')
->toggleable()
- ->view('zeus::filament.columns.tag-counts'),
+ ->getStateUsing(
+ fn(Tag $record): int => method_exists($record, $record->type)
+ ? $record->{$record->type}()->count()
+ : 0
+ ),
])
->filters([
SelectFilter::make('type')
diff --git a/src/SkyServiceProvider.php b/src/SkyServiceProvider.php
index 0f818da..bf83d87 100644
--- a/src/SkyServiceProvider.php
+++ b/src/SkyServiceProvider.php
@@ -58,7 +58,7 @@ protected function getMigrations(): array
private function bootFilamentNavigation(): void
{
- if (! app('filament')->hasPlugin('zeus-sky') && ! app('filament')->hasPlugin('navigation')) {
+ if (! app('filament')->hasPlugin('zeus-sky') || ! app('filament')->hasPlugin('navigation')) {
return;
}