added initial entries model

This commit is contained in:
jon brookes 2026-01-02 13:58:06 +00:00
parent 11f1dc6895
commit a0a1c08ece
19 changed files with 487 additions and 6 deletions

View file

@ -0,0 +1,39 @@
<?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(),
]);
}
}

View file

@ -0,0 +1,38 @@
<?php
namespace App\Filament\Resources\Entries\Schemas;
use Filament\Infolists\Components\IconEntry;
use Filament\Infolists\Components\TextEntry;
use Filament\Schemas\Schema;
class EntryInfolist
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
TextEntry::make('title'),
TextEntry::make('slug'),
TextEntry::make('description')
->placeholder('-')
->columnSpanFull(),
IconEntry::make('is_published')
->boolean(),
IconEntry::make('is_featured')
->boolean(),
TextEntry::make('published_at')
->date()
->placeholder('-'),
TextEntry::make('content')
->placeholder('-')
->columnSpanFull(),
TextEntry::make('created_at')
->dateTime()
->placeholder('-'),
TextEntry::make('updated_at')
->dateTime()
->placeholder('-'),
]);
}
}