40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Filament\Resources\Entries\Schemas;
|
||
|
|
|
||
|
|
use Filament\Forms\Components\DatePicker;
|
||
|
|
use Filament\Forms\Components\RichEditor;
|
||
|
|
use Filament\Forms\Components\TextInput;
|
||
|
|
use Filament\Forms\Components\Textarea;
|
||
|
|
use Filament\Forms\Components\Toggle;
|
||
|
|
use Filament\Schemas\Schema;
|
||
|
|
use Illuminate\Support\Str;
|
||
|
|
|
||
|
|
class EntryForm
|
||
|
|
{
|
||
|
|
public static function configure(Schema $schema): Schema
|
||
|
|
{
|
||
|
|
return $schema
|
||
|
|
->components([
|
||
|
|
TextInput::make('title')
|
||
|
|
->required()
|
||
|
|
->reactive()
|
||
|
|
->afterStateUpdated(function ($state, $set): void {
|
||
|
|
$set('slug', Str::slug((string) $state));
|
||
|
|
}),
|
||
|
|
TextInput::make('slug')
|
||
|
|
->required()
|
||
|
|
->disabled(),
|
||
|
|
Textarea::make('description')
|
||
|
|
->columnSpanFull(),
|
||
|
|
Toggle::make('is_published')
|
||
|
|
->required(),
|
||
|
|
Toggle::make('is_featured')
|
||
|
|
->required(),
|
||
|
|
DatePicker::make('published_at'),
|
||
|
|
RichEditor::make('content')
|
||
|
|
->columnSpanFull(),
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
}
|