From bb3e91df368dc72ee18ab5d1aea30936f6f18c97 Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Thu, 2 Nov 2023 11:44:20 +0100 Subject: [PATCH] feat: remove table model by passing null to with() --- src/MySQL.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/MySQL.php b/src/MySQL.php index e62c7af..f4b5c7d 100644 --- a/src/MySQL.php +++ b/src/MySQL.php @@ -48,7 +48,13 @@ } // Restrict query to array of column names - public function with(array $model): self { + public function with(?array $model = null): self { + // Remove table model if empty + if (!$model) { + $this->model = null; + return $this; + } + // Reset table model $this->model = [];