Skip to content

Commit

Permalink
improvement: add model.load is an expressive alias to model.preload
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Nov 30, 2020
1 parent 86a5b34 commit 5e517b6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions adonis-typings/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ declare module '@ioc:Adonis/Lucid/Model' {
save(): Promise<this>
delete(): Promise<void>
refresh(): Promise<this>
load: LucidRowPreload<this>
preload: LucidRowPreload<this>

/**
Expand Down
2 changes: 1 addition & 1 deletion npm-audit.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h5 class="card-title">
<div class="card">
<div class="card-body">
<h5 class="card-title">
November 30th 2020, 10:48:01 am
November 30th 2020, 10:49:40 am
</h5>
<p class="card-text">Last updated</p>
</div>
Expand Down
7 changes: 7 additions & 0 deletions src/Orm/BaseModel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1610,6 +1610,13 @@ export class BaseModel implements LucidRow {
return this
}

/**
* A more expressive alias for "this.preload"
*/
public async load(relationName: any, callback?: any) {
return this.preload(relationName, callback)
}

/**
* Preloads one or more relationships for the current model
*/
Expand Down

0 comments on commit 5e517b6

Please sign in to comment.