From 35ceb9724124f0037f1af85d2ced97d231c82508 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Sun, 10 Nov 2024 13:08:05 +0000 Subject: [PATCH] - Added Exists method --- src/Repository.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Repository.php b/src/Repository.php index f8a8de9..ffe52b5 100644 --- a/src/Repository.php +++ b/src/Repository.php @@ -100,6 +100,11 @@ class Repository return Ulmus::runSelectQuery($this->queryBuilder, $this->adapter)->fetchColumn(0); } + public function exists(mixed $primaryKey) : bool + { + return $this->wherePrimaryKey($primaryKey)->count() !== 0; + } + public function deleteOne() { return $this->limit(1)->deleteSqlQuery()->runDeleteQuery();