feat: tambah modul blog dengan resource Filament, halaman publik, dan PostSeeder
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Posts\Schemas;
|
||||
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class PostForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
TextInput::make('title')->label('Judul')->required()
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(fn ($state, $set) => $set('slug', Str::slug($state))),
|
||||
TextInput::make('slug')->required()->unique(ignoreRecord: true),
|
||||
Select::make('category')->label('Kategori')
|
||||
->options([
|
||||
'umum' => 'Umum',
|
||||
'pengumuman' => 'Pengumuman',
|
||||
'berita' => 'Berita',
|
||||
])
|
||||
->default('umum')->required(),
|
||||
DateTimePicker::make('published_at')->label('Tanggal Publikasi')
|
||||
->helperText('Kosongkan untuk menyimpan sebagai draft'),
|
||||
RichEditor::make('content')->label('Konten')->required()->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user