31 lines
1.0 KiB
PHP
31 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\MyPosts\Schemas;
|
|
|
|
use Filament\Forms\Components\RichEditor;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Schemas\Schema;
|
|
use Illuminate\Support\Str;
|
|
|
|
class MyPostForm
|
|
{
|
|
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(),
|
|
RichEditor::make('content')->label('Konten')->required()->columnSpanFull(),
|
|
]);
|
|
}
|
|
}
|