Skip to content

Commit

Permalink
Merge pull request #4 from BinaryAlan/fix-delete
Browse files Browse the repository at this point in the history
fix(delete) return true when 404
  • Loading branch information
BinaryAlan authored Oct 12, 2024
2 parents bbb65d9 + 167b618 commit 1497642
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,17 @@ public function update(array $value, $id)
*/
public function delete(string $id): bool
{
$result = $this->run(
'delete',
[
'index' => $this->model->getIndex(),
'id' => $id,
],
);
try {
$result = $this->run(
'delete',
[
'index' => $this->model->getIndex(),
'id' => $id,
],
);
} catch (Missing404Exception) {
return true;
}
if (! empty($result['result']) && $result['result'] == 'deleted') {
return true;
}
Expand Down

0 comments on commit 1497642

Please sign in to comment.