From 3f3203218645402fc3897d5623b173d9bca5c956 Mon Sep 17 00:00:00 2001 From: Muhammad Fikri Date: Mon, 16 Jun 2025 06:41:34 +0700 Subject: [PATCH] fix updateOrCreate The firstOrNew method is async and returns a Promise, but it's being passed directly to tap, which expects the actual instance. --- src/builder.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/builder.js b/src/builder.js index dcfe789..e8c79fa 100644 --- a/src/builder.js +++ b/src/builder.js @@ -864,7 +864,7 @@ class Builder { } async updateOrCreate(attributes, values = {}) { - return await tap(this.firstOrNew(attributes), async (instance) => { + return await tap(await this.firstOrNew(attributes), async (instance) => { await instance.fill(values).save({ client: this.query }); @@ -1075,4 +1075,4 @@ class Builder { } } -module.exports = Builder; \ No newline at end of file +module.exports = Builder;