-
Notifications
You must be signed in to change notification settings - Fork 101
Description
I believe that you should check wasRecentlyCreated on models and reload them if it is true before calling attributesToArray.
Currently, because you are using attributesToArray, newly created models will only return attributes that have been modified / updated. This means the attributes list may not be complete, and the next time the model is loaded and modified, then all attributes will be returned with attributesToArray... This will result in the second "version" of the model including the attributes, even if they haven't been modified, and it will appear as if they were changed when doing a diff. I also suspect that it would cause issues when attempting to roll back to the initial version.
My current workaround is to using a create method on the model to do: $model = self::find(self::create()->id) to ensure that the initial version contains the full list of serialized attributes.