vendredi 22 février 2019

How do you get changes to laravel model in hasMany relationship?

I have model "Contact" which hasMany "Address". When saving the Contact with a new Address

...
//$contact = some instance of Contact
$contact->addresses()->save(new Address(['street' => '4811 Example Dr.']));

dd($contact->getChanges()); // returns null
// dd($contact->addresses()->getChanges()); // method not available   
// dd($contact->addresses->getChanges()); // method not available

How can I check which changes were actually made after the save call?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire