Skip to content

Commit

Permalink
Merge 7497c3e into 23dc3eb
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Sep 12, 2018
2 parents 23dc3eb + 7497c3e commit d0cc6b5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Lucid/Model/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,9 @@ class Model extends BaseModel {
query.transacting(trx)
}

if (this.isDirty) {
const isDirty = this.isDirty

if (isDirty) {
/**
* Set proper timestamps
*/
Expand All @@ -674,16 +676,20 @@ class Model extends BaseModel {
.where(this.constructor.primaryKey, this.primaryKeyValue)
.ignoreScopes()
.update(this)
/**
* Sync originals to find a diff when updating for next time
*/
this._syncOriginals()
}

/**
* Executing after hooks
*/
await this.constructor.$hooks.after.exec('update', this)

if (isDirty) {
/**
* Sync originals to find a diff when updating for next time
*/
this._syncOriginals()
}

return !!affected
}

Expand Down

0 comments on commit d0cc6b5

Please sign in to comment.