How to create a modal form

I try to read the documentation but it is not clear, I don't understand how to implement Action::make() in Form class if:
public function form(Form $form): Form
{
return $form
->schema([

])
->statePath('data')
->model(Event::class);
}
public function form(Form $form): Form
{
return $form
->schema([

])
->statePath('data')
->model(Event::class);
}
Form returns this. Action::make() is a little different. https://filamentphp.com/docs/3.x/actions/modals#modal-forms
Action::make('updateAuthor')
->form([
Select::make('authorId')
->label('Author')
->options(User::query()->pluck('name', 'id'))
->required(),
])
->action(function (array $data, Post $record): void {
$record->author()->associate($data['authorId']);
$record->save();
})
Action::make('updateAuthor')
->form([
Select::make('authorId')
->label('Author')
->options(User::query()->pluck('name', 'id'))
->required(),
])
->action(function (array $data, Post $record): void {
$record->author()->associate($data['authorId']);
$record->save();
})
I created a component with the command : php artisan make:livewire-form Foo Any assistance is welcome, thanks!
1 Reply
Want results from more Discord servers?
Add your server