vendredi 8 avril 2016

Laravel 5.1 - How to pass a variable from event::updating to event::updated?

I'm trying to create a logging trait that would also save all changes to relationships (many to many).

So far my idea is to store the model with all the relationships in static::updating event of the loggable model as $original. And then fetch the $original variable in static::updated event and compare the differences and log accordingly.

What would be a good way to go about doing this. If there's a better method to doing this I'm happy to hear about it.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire