Skip to content

Commit a2ede73

Browse files
committed
[Update] deleteWhere method to pass second argument for forceDelete
1 parent cb5a094 commit a2ede73

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Contracts/RepositoryInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function upsert(array $values, array|string $uniqueBy, array|null $update
5959

6060
public function delete(int $id): mixed;
6161

62-
public function deleteWhere(array $where): ?bool;
62+
public function deleteWhere(array $where, bool $forceDelete = false): ?bool;
6363

6464
public function massDelete(): ?bool;
6565

src/Eloquent/BaseRepository.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,13 @@ public function delete(int $id): mixed
375375
return $this->manageDeletes($id, 'delete');
376376
}
377377

378-
public function deleteWhere(array $where): ?bool
378+
public function deleteWhere(array $where, bool $forceDelete = false): ?bool
379379
{
380380
$this->applyScope();
381381
$this->applyConditions($where);
382382

383-
$deleted = $this->model->delete();
383+
$method = $forceDelete ? 'forceDelete' : 'delete';
384+
$deleted = $this->model->{$method}();
384385

385386
event(new RepositoryEntityDeleted($this, $this->model->getModel()));
386387

0 commit comments

Comments
 (0)