Skip to content

Commit

Permalink
feat(SoftDeletes): add table name to onlyTrashed method
Browse files Browse the repository at this point in the history
  • Loading branch information
LookinGit committed Aug 23, 2021
1 parent 7a4dbc2 commit dbcb2b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/SoftDeletes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export function SoftDeletes<T extends NormalizeConstructor<LucidModel>> (supercl
public static onlyTrashed<Model extends typeof ModelWithSoftDeletes>(
this: Model
): ModelQueryBuilderContract<Model, InstanceType<Model>> {
return this.disableIgnore(this.query()).whereNotNull('deleted_at')
const query = this.query()
return this.disableIgnore(query).whereNotNull(`${query.model.table}.deleted_at`)
}

/**
Expand Down

0 comments on commit dbcb2b7

Please sign in to comment.