Skip to content

Commit 18ca78c

Browse files
swzndkiddyuchina
authored andcommitted
fix updateOrCreate
The firstOrNew method is async and returns a Promise, but it's being passed directly to tap, which expects the actual instance.
1 parent 6676dd5 commit 18ca78c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/builder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ class Builder {
864864
}
865865

866866
async updateOrCreate(attributes, values = {}) {
867-
return await tap(this.firstOrNew(attributes), async (instance) => {
867+
return await tap(await this.firstOrNew(attributes), async (instance) => {
868868
await instance.fill(values).save({
869869
client: this.query
870870
});
@@ -1075,4 +1075,4 @@ class Builder {
10751075
}
10761076
}
10771077

1078-
module.exports = Builder;
1078+
module.exports = Builder;

0 commit comments

Comments
 (0)