F
Filament13mo ago
dwong98

Getting previous child relationship data before saving the parent data.

Hi, i am trying to create a version control on a model. Let's say i have a model called Assets, and Assets can have many different versions. Once a user click 'save' in the edit page, I used hooks in EditAssets to create an record in asset versions control table first, then only continue updating the model. However, i can't to seems to get the old child relationships' data, but the parent Model works fine as i can get it through
$this->record
$this->record
I have tried to get the old children relationships' data at afterValidate by calling
$this->record->load('all_the_child_relationships')
$this->record->load('all_the_child_relationships')
but this will get the latest relationship data instead of the old / previous one. Is this because the relationship was synced / save as soon as the 'save' button is clicked? If this is the reason, any way that i can get the old relationships data before saving it?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server