Force deleting record error $record must not be accessed before initialization

When I delete a record the page shows an error before redirecting.
Typed property Filament\Resources\Pages\EditRecord::$record must not be accessed before initialization
protected function getActions(): array
{
return [
Actions\CreateAction::make()
->record($this->getRecord())
->url(fn ($record) => self::$resource::getUrl('create'))
];
}
protected function getActions(): array
{
return [
Actions\CreateAction::make()
->record($this->getRecord())
->url(fn ($record) => self::$resource::getUrl('create'))
];
}
5 Replies
toeknee
toeknee15mo ago
That's just the stack trace, what's the error
exactwebitesolutions
Typed property Filament\Resources\Pages\EditRecord::$record must not be accessed before initialization
toeknee
toeknee15mo ago
Can you provide your edit and resource pages.
exactwebitesolutions
Fixed it thanks - I had SoftDeletes but forgot to add:
->withoutGlobalScopes([
SoftDeletingScope::class,
])
->withoutGlobalScopes([
SoftDeletingScope::class,
])
I should have tried to reproduce this in a simple example before posting might be of help to somebody else.
toeknee
toeknee15mo ago
Great
Want results from more Discord servers?
Add your server