Failed restore causes later updates to fail #793
Unanswered
goodevilgenius
asked this question in
Q&A
Replies: 1 comment
-
Hi, If you know how to solve it please make a PR with some tests to avoid breaking that on the future, thanks |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Actual Behaviour
Update audit event does not occur if a previous restore failed.
Expected Behaviour
Update should happen regardless of previous restore.
Steps to Reproduce
Image code along the following lines:
Because
$model1->restore
failed, therestored
model event was never fired. Because of this,AuditableObserver::$restoring
is still set to true.Because
AuditableObserver::$restoring
is stilltrue
,$model2->update
doesn't trigger theupdated
audit event.Possible Solutions
I worked around this locally by modifying my model to have a
$restoring
property initialized tofalse
. I then created my ownrestore
method like this:I then extended
AuditableObserver
and overrode theupdated
method like this:And then, of course, overrode the
bootAuditable
method to observe my newAuditableObserver
.Beta Was this translation helpful? Give feedback.
All reactions