- Added Exists method

This commit is contained in:
Dave Mc Nicoll 2024-11-10 13:08:05 +00:00
parent 411992c7a8
commit 35ceb97241
1 changed files with 5 additions and 0 deletions

View File

@ -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();