-
Notifications
You must be signed in to change notification settings - Fork 404
Description
| Q | A |
|---|---|
| Bug? | maybe |
| New Feature? | no |
| Framework | Laravel |
| Framework version | 9.0.0 |
| Package version | 12.0.0 |
| PHP version | 8.1 |
Actual Behaviour
I am making changes to some models which use the Auditable trait within the context of a db transaction. I need to do this because there are chunk of changes which are happening and i need to be able to rollback if something goes wrong. I have noticed that the changes to the values of these models are being audited as empty objects. (see example in this image)

Could it be that the audits are happening before the changes are being committed to the database or maybe am i missing something myself?
Expected Behaviour
I would expect that the correct new values are being audited in the database.
Steps to Reproduce
`DB::beginTransaction();
try {
$fund->amount = 5000;
$fund->save();
.....
DB::commit();
}`
Possible Solutions
Not sure if there is a way of delaying the audit until the actual transaction is committed perhaps ? I can't think of any other way to somehow include the audit within the same database transaction?
thanks