Implementa gestão Filament de configurações, serviços, portfólio e depoimentos com policies admin-only, upload validado e seed determinístico. Co-authored-by: Cursor <cursoragent@cursor.com>
85 lines
3.1 KiB
PHP
85 lines
3.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Filament\Resources\PortfolioCases\Schemas;
|
|
|
|
use App\Support\PublicImageUploadRules;
|
|
use Filament\Forms\Components\DatePicker;
|
|
use Filament\Forms\Components\DateTimePicker;
|
|
use Filament\Forms\Components\Textarea;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Components\Toggle;
|
|
use Filament\Schemas\Schema;
|
|
|
|
class PortfolioCaseForm
|
|
{
|
|
public static function configure(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
TextInput::make('title')
|
|
->label('Título')
|
|
->required()
|
|
->maxLength(255)
|
|
->live(onBlur: true)
|
|
->afterStateUpdated(function (?string $state, callable $set, callable $get): void {
|
|
if (blank($get('slug'))) {
|
|
$set('slug', str($state)->slug()->toString());
|
|
}
|
|
}),
|
|
TextInput::make('slug')
|
|
->label('Slug')
|
|
->required()
|
|
->maxLength(255)
|
|
->unique(ignoreRecord: true),
|
|
TextInput::make('summary')
|
|
->label('Resumo')
|
|
->required()
|
|
->maxLength(255),
|
|
TextInput::make('event_type')
|
|
->label('Tipo de evento')
|
|
->required()
|
|
->maxLength(255),
|
|
TextInput::make('city')
|
|
->label('Cidade')
|
|
->maxLength(255),
|
|
TextInput::make('venue')
|
|
->label('Local')
|
|
->maxLength(255),
|
|
DatePicker::make('event_date')
|
|
->label('Data do evento'),
|
|
Textarea::make('challenge')
|
|
->label('Desafio')
|
|
->required()
|
|
->rows(4),
|
|
Textarea::make('solution')
|
|
->label('Solução')
|
|
->required()
|
|
->rows(4),
|
|
Textarea::make('result')
|
|
->label('Resultado')
|
|
->rows(4),
|
|
PublicImageUploadRules::fileUpload('cover_image_path', 'Imagem de capa'),
|
|
PublicImageUploadRules::altTextField('cover_image_alt', 'cover_image_path'),
|
|
TextInput::make('sort_order')
|
|
->label('Ordem')
|
|
->numeric()
|
|
->default(0)
|
|
->required(),
|
|
Toggle::make('is_featured')
|
|
->label('Destaque')
|
|
->default(false),
|
|
DateTimePicker::make('published_at')
|
|
->label('Publicado em')
|
|
->seconds(false),
|
|
TextInput::make('meta_title')
|
|
->label('Meta title')
|
|
->maxLength(255),
|
|
Textarea::make('meta_description')
|
|
->label('Meta description')
|
|
->rows(3),
|
|
]);
|
|
}
|
|
}
|