How can I save data in custom modal?

Action::make('customModal')
->label('Custom Modal')
->action(fn ($record, $set) => $set('record', $record)) // Custom action
->modalHeading('Custom Modal Başlığı')
->modalContent(function ($record) {

return view('filament.pages.test_modal', ['record' => $record]);
})
)
Action::make('customModal')
->label('Custom Modal')
->action(fn ($record, $set) => $set('record', $record)) // Custom action
->modalHeading('Custom Modal Başlığı')
->modalContent(function ($record) {

return view('filament.pages.test_modal', ['record' => $record]);
})
)
I send my own record data here, I made changes, for example, how do I save them?
6 Replies
Roland Barkóczi
https://filamentphp.com/docs/3.x/actions/modals#modal-forms you can add your business logic to the ->action() as a callback closure
Mehmet K.
Mehmet K.2w ago
->action(function (array $data, Post $record): void { $record->author()->associate($data['authorId']); $record->save(); }) I added it this way, but when I pressed send from the inputs I added, no data came out.
Mehmet K.
Mehmet K.2w ago
No description
No description
No description
Roland Barkóczi
Maybe something wrong in your blade file. Why don't you just add the form schema to the modal action?
Mehmet K.
Mehmet K.2w ago
I cannot use Repeater because the data is not coming in and I need to make a different design because it does not provide the freedom I want.
Topherllobrera
Is it fillable in your model?
Want results from more Discord servers?
Add your server