Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
scrs_zdenek committed Aug 13, 2024
1 parent a9831de commit 5488236
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions src/Drago/Database/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,16 @@ public function get(int $id): Fluent


/**
* Deleting a records
* Deleting a records.
* @throws AttributeDetectionException
*/
public function remove(...$cond): Result|int|null
public function remove(int|string|array ...$cond): Fluent
{
return $this->db->delete($this->getTableName())
->where(...$cond)
->execute();
}


/**
* Deleting a record by the primary key.
* @throws Exception
* @throws AttributeDetectionException
*/
public function removeById(int $id): Result|int|null
{
return $this->db->delete($this->getTableName())
->where('%n = ?', $this->getPrimaryKey(), $id)
->execute();
$delete = $this->db->delete($this->getTableName());
if (is_int($cond)) $delete->where('%n = ?', $this->getPrimaryKey(), $cond); else {
$delete->where(...$cond);
}
return $delete;
}


Expand Down

0 comments on commit 5488236

Please sign in to comment.