Get Relationship data before update #8615
-
Dears, how to get relationship data in the Edit Page, because if I used handleRecordUpdate or mutateFormDataBeforeSave I can't catch the the relation data, and it will be already updated after these methods. What I want to do is: Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I think you can set protected function handleRecordUpdate(Model $record, array $data): Model
{
//now you can access $data['yourRelationship']...
$record->update($data);
return $record;
} |
Beta Was this translation helpful? Give feedback.
-
thank you for your reply, But my problem is still not fixed, the problem is that I want to catch the relation data before updating. |
Beta Was this translation helpful? Give feedback.
-
Problem solved? |
Beta Was this translation helpful? Give feedback.
I think you can use
saveRelationshipsUsing()
in your relationship