class PostsRelationManager extends RelationManager
{
public function form(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('title'),
])
->formRequest(class: fn () => StorePostRequest::class);
}
}
use Filament\Tables\Filters\Filter;
use Filament\Tables\Table;
public function table(Table $table): Table
{
return $table
->filters([
Filter::make('created')
->schema([
DatePicker::make('from'),
DatePicker::make('until'),
]),
])
->filtersFormRequest(class: fn () => FilterCustomersRequest::class);
}
// app/Http/Requests/FilterCustomersRequest.php
public function rules(): array
{
return [
'created.from' => ['nullable', 'date'],
'created.until' => ['nullable', 'date', 'after_or_equal:created.from'],
];
}
TextInput::make('email')->email()->nullable()
// Form Request
'email' => ['
Checkbox::make('terms_accepted')->label('I accept the terms'),
// or
Hidden::make('terms_accepted'),
use OccTherapist\FormRequestValidationForFilament\Concerns\InteractsWithFormRequestValidation;
class CreateUser extends CreateRecord
{
use InteractsWithFormRequestValidation;
protected function handleRecordCreation(array $data): Model
{
$data = $this->getFormRequestValidated();
return User::create($data);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.