Check if the data has been change before saving

I'm trying to send a notification to the process owner everytime the data of process owner is change after saving. I don't want to spam notification everytime the user click the save so I want to check it before saving. The code below always returns false even if I'm changing the value of the process_owner protected function beforeSave(): void { dd($this->record->isDirty('process_owner')); }
2 Replies
Andrew Wallo
Andrew Wallo14mo ago
For fields that have relationships, make sure for the field to use “saveRelationshipsUsing(null)”. If you don’t do that the record attributes will show they haven’t been changed if you are handling them after saving. Maybe use a method where you can compare the data array and the record attributes.
Andrew Wallo
Andrew Wallo14mo ago
GitHub
erpsaas/app/Filament/Company/Pages/Setting/Appearance.php at 2.x · ...
Contribute to andrewdwallo/erpsaas development by creating an account on GitHub.
Want results from more Discord servers?
Add your server