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\BlogResource\Pages\CreateBlog;
|
||||
use App\Filament\Resources\BlogResource\Pages\EditBlog;
|
||||
use App\Filament\Resources\BlogResource\Pages\ListBlogs;
|
||||
@@ -33,13 +35,13 @@ class BlogResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Blog::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-m-newspaper';
|
||||
protected static string|BackedEnum|null $navigationIcon = 'heroicon-m-newspaper';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Content';
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Content';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
$categories = Category::pluck('name', 'id')->toArray();
|
||||
Category::query()->pluck('name', 'id')->toArray();
|
||||
|
||||
return $schema
|
||||
->components([
|
||||
@@ -50,7 +52,7 @@ class BlogResource 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()
|
||||
@@ -132,7 +134,7 @@ class BlogResource extends Resource
|
||||
Action::make('togglePublished')
|
||||
->label('Toggle Published')
|
||||
->icon('heroicon-o-eye')
|
||||
->action(function (Blog $record) {
|
||||
->action(function (Blog $record): void {
|
||||
$record->update(['is_published' => ! $record->is_published]);
|
||||
}),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user