How to make custom delete if the primary key is "key" not id?
This is my model
and this the table action
protected $primaryKey = 'key';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'key',
'value',
'scope',
'label',
'description',
'type',
'options',
'is_readonly',
];
//I already add this for the delete but not working
public function getRouteKeyName(): string
{
return 'key';
}
protected $primaryKey = 'key';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'key',
'value',
'scope',
'label',
'description',
'type',
'options',
'is_readonly',
];
//I already add this for the delete but not working
public function getRouteKeyName(): string
{
return 'key';
}
Tables\Actions\DeleteAction::make(),
\\I also try this but not working
Tables\Actions\DeleteAction::make()
->requiresConfirmation()
->action(function ($record) {
$record->delete();
return Redirect::route('filament.admin.resources.settings.index');
})
Tables\Actions\DeleteAction::make(),
\\I also try this but not working
Tables\Actions\DeleteAction::make()
->requiresConfirmation()
->action(function ($record) {
$record->delete();
return Redirect::route('filament.admin.resources.settings.index');
})
0 Replies