Skip to content

Commit abf3909

Browse files
authored
Update Database.php
1 parent 4ef145c commit abf3909

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

src/Drago/Database/Database.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,19 @@ public function get(int $id): ExtraFluent
9595

9696

9797
/**
98-
* Delete a record by a specific column or by primary key if column is not provided.
98+
* Delete a record by a specific column value.
9999
*
100-
* @param mixed $target Column name or value for primary key.
101-
* @param mixed|null $args Value to match (ignored if only primary key is used).
100+
* @param string $column The column name to search by.
101+
* @param mixed $args The value to match against the column.
102102
* @return ExtraFluent The fluent query builder for deleting the record.
103-
* @throws AttributeDetectionException If table or class is not defined.
103+
* @throws AttributeDetectionException If the table name or class is not defined.
104104
*/
105-
public function delete(mixed $target, mixed $args = null): ExtraFluent
105+
public function delete(string $column, mixed $args): ExtraFluent
106106
{
107-
$column = $args === null ? $this->getPrimaryKey() : $target;
108-
$value = $args ?? $target;
109-
110107
return $this->command()
111108
->delete()
112109
->from($this->getTableName())
113-
->where('%n = ?', $column, $value);
110+
->where('%n = ?', $column, $args);
114111
}
115112

116113

0 commit comments

Comments
 (0)