Edit Lifecycle hooks ->before is not working

Hi, I'm trying to use the ->before() to add some logic to the record but is not being triggered. any ideas?
->actions([
Tables\Actions\EditAction::make()
->before(function ($record) {
$order = $record;
dd($order);
}),
])
->actions([
Tables\Actions\EditAction::make()
->before(function ($record) {
$order = $record;
dd($order);
}),
])
1 Reply
norrinradd76
norrinradd765mo ago
Hi, I had a similar problem getting the "after" hook to trigger on a CreateAction. I was able to get this to work by adding an afterCreate method to the resource's corresponding create page and define the logic there. So in your case, find the Edit page for that resource (OrderResource?) and add a "beforeSave()" protected function beforeSave(): void { // Logic here } That worked on my v3 instance.