I have a filament page that mounts a form action -
protected function editAction(): Action
{
return Action::make('edit')
->label('Edit')
->modalHeading('Edit post')
->fillForm(fn (ForumPost $post): array => [
'body' => $post->body,
])
->form([
Components\MarkdownEditor::make('body')
->required(),
])
->action(function (array $data, ForumPost $post) {
$post->update([
'body' => $data['body'],
'body_html' => Markdown::render($data['body']),
'edited_at' => now(),
]);
Notification::make()
->title('Post updated')
->success()
->send();
});
}
This is called in my blade file with {{ ($this->editAction)(['post' => $post->id]) }}. The form opens but fails to fill in the data and I don't understand why it is failing.