Case/Scenario:
I add DeleteAction on my SettingsResource table but I got error404
after I click the confirm in the confirmation modal. AlThough I had "id" in the model but I used "key" as primary key in the settings.
REPLICATE:
Model
protected $primaryKey = 'key';
public $incrementing = false;
protected static function getRecordRouteKeyName(): string
{
return 'key';
}
SettingResource
Tables\Actions\Action::make('delete')
->label('Delete')
->color('danger')
->requiresConfirmation()
->icon('heroicon-o-trash')
->action(fn (Setting $record) => $record->delete())
->after(fn ($livewire) => $livewire->dispatch('reload'))
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
protected function getListeners(): array
{
return [
'reload' => '$refresh',
];
}
Still stuck in error404 after delete