From 2afd1fb672a870ebffc59b2dbccb5f4f40eece22 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Sat, 20 Jul 2024 07:51:05 +0000 Subject: [PATCH] Updated 1 files --- .../App/Resources/ContentResource.php | 96 ++++++++++--------- 1 file changed, 52 insertions(+), 44 deletions(-) diff --git a/app/Filament/App/Resources/ContentResource.php b/app/Filament/App/Resources/ContentResource.php index 9a9d90f..ac49d7e 100644 --- a/app/Filament/App/Resources/ContentResource.php +++ b/app/Filament/App/Resources/ContentResource.php @@ -1,4 +1,53 @@ +schema([ + Forms\Components\TextInput::make('content_title') + ->required() + ->maxLength(255), + Forms\Components\Select::make('author_id') + ->relationship('author', 'author_name') + ->required(), + Forms\Components\Select::make('category_id') + ->relationship('category', 'content_category_name') + ->required(), + Forms\Components\RichEditor::make('content_body') + ->required(), + Forms\Components\TextInput::make('meta_title') + ->maxLength(255), + Forms\Components\Textarea::make('meta_description') + ->maxLength(65535), + Forms\Components\Toggle::make('is_featured') + ->required(), + Forms\Components\DateTimePicker::make('published_at'), + Forms\Components\Select::make('content_status') + ->options([ + 'draft' => 'Draft', + 'published' => 'Published', 'archived' => 'Archived', ]), Forms\Components\FileUpload::make('featured_image_url') @@ -24,11 +73,11 @@ public static function table(Table $table): Table ->label('Author') ->searchable() ->sortable(), - BelongsToColumn::make('category.content_category_name') + TextColumn::make('category.content_category_name') ->label('Category') ->searchable() ->sortable(), - BadgeColumn::make('content_status') + Tables\Columns\BadgeColumn::make('content_status') ->label('Content Status') ->colors([ 'draft' => 'warning', @@ -49,9 +98,7 @@ public static function table(Table $table): Table Tables\Actions\EditAction::make(), ]) ->bulkActions([ - Tables\Actions\BulkActionGroup::make([ - Tables\Actions\DeleteBulkAction::make(), - ]), + Tables\Actions\DeleteBulkAction::make(), ]); } @@ -70,43 +117,4 @@ public static function getPages(): array 'edit' => Pages\EditContent::route('/{record}/edit'), ]; } - - public static function form(Form $form): Form - { - return $form - ->schema([ - Forms\Components\TextInput::make('content_title') - ->required() - ->maxLength(255), - Forms\Components\Select::make('author_id') - ->relationship('author', 'author_name') - ->required(), - Forms\Components\Select::make('category_id') - ->relationship('category', 'content_category_name') - ->required(), - Forms\Components\RichEditor::make('content_body') - ->required(), - Forms\Components\TextInput::make('meta_title') - ->maxLength(255), - Forms\Components\Textarea::make('meta_description') - ->maxLength(65535), - Forms\Components\Toggle::make('is_featured') - ->required(), - Forms\Components\DateTimePicker::make('published_at'), - Forms\Components\Select::make('content_status') - ->options([ - 'draft' => 'Draft', - 'published' => 'Published', - 'archived' => 'Archived', - ]), - Forms\Components\FileUpload::make('featured_image_url') - ->image() - ->directory('content-images') - ->label('Featured Image'), - Forms\Components\TagsInput::make('tag') - ->label('Tags') - ->separator(',') - ->relationship('tag', 'tag_name'), - ]); - } }