chore: code refactor via rector
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use BackedEnum;
|
||||
use UnitEnum;
|
||||
use App\Filament\Resources\PageResource\Pages\CreatePage;
|
||||
use App\Filament\Resources\PageResource\Pages\EditPage;
|
||||
use App\Filament\Resources\PageResource\Pages\ListPages;
|
||||
@@ -32,13 +34,13 @@ class PageResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Page::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-document';
|
||||
protected static string|BackedEnum|null $navigationIcon = 'heroicon-o-document';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Content';
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Content';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
$pages = Page::Pluck('title', 'id')->toArray();
|
||||
$pages = Page::query()->Pluck('title', 'id')->toArray();
|
||||
|
||||
return $schema
|
||||
->components([
|
||||
@@ -50,7 +52,7 @@ class PageResource extends Resource
|
||||
->required()
|
||||
->live(1)
|
||||
->columnSpanFull()
|
||||
->afterStateUpdated(fn (Set $set, ?string $state) => $set('slug', Str::slug($state))),
|
||||
->afterStateUpdated(fn (Set $set, ?string $state): mixed => $set('slug', Str::slug($state))),
|
||||
TextInput::make('slug')->required()->columnSpan(3),
|
||||
Select::make('is_published')
|
||||
->options([
|
||||
@@ -114,7 +116,7 @@ class PageResource extends Resource
|
||||
Action::make('togglePublished')
|
||||
->label('Toggle Published')
|
||||
->icon('heroicon-o-eye')
|
||||
->action(function (Page $record) {
|
||||
->action(function (Page $record): void {
|
||||
$record->update(['is_published' => ! $record->is_published]);
|
||||
}),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user