diff --git a/src/Resources/RedirectResource.php b/src/Resources/RedirectResource.php index 0df6ba6..2a12ade 100644 --- a/src/Resources/RedirectResource.php +++ b/src/Resources/RedirectResource.php @@ -54,34 +54,34 @@ public static function form(Form $form): Form ->prefixIcon('heroicon-o-link') ->options(Site::orderBy('default', 'desc')->orderBy('name', 'asc')->pluck('name', 'ulid')) ->default(Site::where('default', true)->first()?->ulid) - ->visible(fn() => Schema::hasColumn('redirects', 'content_ulid') && Site::count() > 0) - ->hidden(fn() => Schema::hasColumn('redirects', 'content_ulid') && Site::count() === 1), + ->visible(fn () => Schema::hasColumn('redirects', 'content_ulid') && Site::count() > 0) + ->hidden(fn () => Schema::hasColumn('redirects', 'content_ulid') && Site::count() === 1), Select::make('country_code') ->label(__('Country')) ->columnSpan(4) ->placeholder(__('Select Country')) ->prefixIcon('heroicon-o-globe-europe-africa') - ->options(Language::whereNotNull('country_code')->distinct('country_code')->get()->mapWithKeys(fn($language) => [ - $language->code => ' ' . Locale::getDisplayLanguage($language->code, app()->getLocale()) + ->options(Language::whereNotNull('country_code')->distinct('country_code')->get()->mapWithKeys(fn ($language) => [ + $language->code => ' ' . Locale::getDisplayLanguage($language->code, app()->getLocale()), ])->sort()) ->allowHtml() ->default(Language::whereNotNull('country_code')->distinct('country_code')->count() === 1 ? Language::whereNotNull('country_code')->first()->country_code : null) - ->visible(fn() => Schema::hasColumn('redirects', 'content_ulid') && Language::whereNotNull('country_code')->distinct('country_code')->count() > 0) - ->hidden(fn() => Schema::hasColumn('redirects', 'content_ulid') && Language::whereNotNull('country_code')->distinct('country_code')->count() === 1), + ->visible(fn () => Schema::hasColumn('redirects', 'content_ulid') && Language::whereNotNull('country_code')->distinct('country_code')->count() > 0) + ->hidden(fn () => Schema::hasColumn('redirects', 'content_ulid') && Language::whereNotNull('country_code')->distinct('country_code')->count() === 1), Select::make('language_code') ->label(__('Language')) ->columnSpan(4) ->placeholder(__('Select Language')) ->prefixIcon('heroicon-o-language') ->options( - Language::get()->mapWithKeys(fn($language) => [ - $language->code => ' ' . Locale::getDisplayLanguage($language->code, app()->getLocale()) + Language::get()->mapWithKeys(fn ($language) => [ + $language->code => ' ' . Locale::getDisplayLanguage($language->code, app()->getLocale()), ])->sort() ) ->allowHtml() ->default(Language::count() === 1 ? Language::first()->code : Language::where('default', true)->first()->code) - ->visible(fn() => Schema::hasColumn('redirects', 'content_ulid') && Language::count() > 0) - ->hidden(fn() => Schema::hasColumn('redirects', 'content_ulid') && Language::count() === 1), + ->visible(fn () => Schema::hasColumn('redirects', 'content_ulid') && Language::count() > 0) + ->hidden(fn () => Schema::hasColumn('redirects', 'content_ulid') && Language::count() === 1), TextInput::make('source') ->label(__('Source')) ->columnSpan(12) @@ -100,7 +100,7 @@ public static function form(Form $form): Form ->label(__('Type')) ->columnSpan(4) ->native(false) - ->options(collect(config('redirects.status_codes'))->map(fn(string $type, int $code) => $type . ' (' . $code . ')')) + ->options(collect(config('redirects.status_codes'))->map(fn (string $type, int $code) => $type . ' (' . $code . ')')) ->searchable() ->required() ->default(config('redirects.default_status_code')) @@ -112,7 +112,7 @@ public static function form(Form $form): Form ->placeholder('Content') ->prefixIcon('heroicon-o-link') ->helperText(__('Select a content page to redirect to the current URL.')) - ->visible(fn() => Schema::hasColumn('redirects', 'content_ulid')), + ->visible(fn () => Schema::hasColumn('redirects', 'content_ulid')), TextInput::make('destination') ->label(__('Destination')) ->columnSpan(12) diff --git a/src/Resources/RedirectResource/Pages/ListRedirects.php b/src/Resources/RedirectResource/Pages/ListRedirects.php index 3545218..12c3f3f 100644 --- a/src/Resources/RedirectResource/Pages/ListRedirects.php +++ b/src/Resources/RedirectResource/Pages/ListRedirects.php @@ -4,9 +4,8 @@ use Filament\Actions; use Filament\Actions\ActionGroup; -use Filament\Support\Colors\Color; -use Filament\Support\Enums\ActionSize; use Filament\Resources\Pages\ListRecords; +use Filament\Support\Enums\ActionSize; use Vormkracht10\FilamentRedirects\Imports\RedirectImporter; use Vormkracht10\FilamentRedirects\Resources\RedirectResource;