Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

anonymouse703's avatar

How to avoid error pop-up 404 after delete?

I have this SettingsResource for our settings management, instead of id as primary we change it to "key". Though the record is delete but after you click confirm in the confirmation modal a pop-up of error 404|NOT FOUND is pop

I tried this but same error occured

  Action::make('delete')
                    ->label('Delete')
                    ->icon('heroicon-o-trash')
                    ->color('danger')
                    ->action(function ($record) {
                        // Perform the deletion logic here
                        $record->delete();

                        // Optionally, add a success notification
                        Notification::make()
                            ->title('Record Deleted')
                            ->body('The record has been deleted successfully.')
                            ->success()
                            ->send();

                    })
                    ->successRedirectUrl(SettingResource::getUrl('index'))

also this

 Action::make('delete')
                    ->label('Delete')
                    ->successRedirectUrl(SettingResource::getUrl('index'))

This is my model

Class Setting extends Model implements Cacheable
{
    use LogsActivity;

    protected $primaryKey = 'key';
}

Though i add id in the migration to set the subject_id in the logger

0 likes
0 replies

Please or to participate in this conversation.