F
Filamentβ€’10mo ago
Silvio Ney

Delete action in Edit Modal (Simple Resource)

Hi, how can i get the "delete button" on modal using the Simple Resource?
No description
4 Replies
Silvio Ney
Silvio Neyβ€’10mo ago
Thanks! worked like a charm but i have a new problem πŸ˜„ When the record is deleted, modal don't close, the only option i found was using Tables\Actions\DeleteAction::make()->successRedirectUrl(fn () => url()->previous()) but i don't know if is the best solution since this redirects to previous page instead only reload the content. or is the right way to do this and i am thinking wrong XD
Patrick Boivin
Patrick Boivinβ€’10mo ago
The redirect is not a bad idea... can you instead redirect to the page you're on? Something like this:
fn () => MyResource::getUrl('index')
fn () => MyResource::getUrl('index')
Silvio Ney
Silvio Neyβ€’10mo ago
Thanks! This is my code right now and works!
->actions([
Tables\Actions\EditAction::make()->extraModalFooterActions([
Tables\Actions\DeleteAction::make()->requiresConfirmation()->successRedirectUrl(self::getUrl()),
]),
Tables\Actions\DeleteAction::make(),
])
->actions([
Tables\Actions\EditAction::make()->extraModalFooterActions([
Tables\Actions\DeleteAction::make()->requiresConfirmation()->successRedirectUrl(self::getUrl()),
]),
Tables\Actions\DeleteAction::make(),
])
i'll mark as solved, thanks @pboivin