F
Filament17mo ago
as0t

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
as0t
as0tOP17mo 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 Boivin17mo 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')
as0t
as0tOP17mo 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

Did you find this page helpful?