From af14e57dd71e01ac667d624f9e853d38e076ef10 Mon Sep 17 00:00:00 2001 From: Arif Hoque Date: Tue, 7 Apr 2026 12:01:30 +0600 Subject: [PATCH 1/2] fix: withoutHook return type self to Builder: --- .../Entity/Query/InteractsWithModelQueryProcessing.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Phaseolies/Database/Entity/Query/InteractsWithModelQueryProcessing.php b/src/Phaseolies/Database/Entity/Query/InteractsWithModelQueryProcessing.php index ce2410c..5c30434 100644 --- a/src/Phaseolies/Database/Entity/Query/InteractsWithModelQueryProcessing.php +++ b/src/Phaseolies/Database/Entity/Query/InteractsWithModelQueryProcessing.php @@ -38,13 +38,13 @@ public static function query(?string $connection = null): Builder /** * Disable the execution of model hooks for the current instance. * - * @return self + * @return \Phaseolies\Database\Entity\Builder */ - public static function withoutHook(): self + public static function withoutHook(): Builder { self::$isHookShouldBeCalled = false; - return app(static::class); + return static::query(); } /** From 3687f31cfe2a707c385029f888fb1a11d12fca5f Mon Sep 17 00:00:00 2001 From: Arif Hoque Date: Tue, 7 Apr 2026 12:11:40 +0600 Subject: [PATCH 2/2] fix: resolve Builder::create() crash when chaining after withoutHook() --- src/Phaseolies/Database/Entity/Builder.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Phaseolies/Database/Entity/Builder.php b/src/Phaseolies/Database/Entity/Builder.php index 63be900..ce6773b 100644 --- a/src/Phaseolies/Database/Entity/Builder.php +++ b/src/Phaseolies/Database/Entity/Builder.php @@ -151,6 +151,22 @@ public function __construct(PDO $pdo, string $table, string $modelClass, int $ro $this->rowPerPage = $rowPerPage; } + /** + * Create a new model instance and save it to the database + * + * @param array $attributes + * @return Model + */ + public function create(array $attributes): Model + { + $modelClass = $this->modelClass; + $model = new $modelClass(); + $model->fill($attributes); + $model->save(); + + return $model; + } + /** * Set the relationship info *