Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Support/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,19 @@ public function debug(bool $debug = true): self
return $this;
}

/**
* Delete specific instance of class
*
* @throws NoClientException
* @throws TokenException
*/
public function delete(int|string $id): bool
{
// TODO: Consider allowing $id to be null & deleting all
return $this->make([$this->getModel()->getKeyName() => $id])
->delete();
}

/**
* Get Collection of class instances that match query
*
Expand Down
2 changes: 1 addition & 1 deletion src/Support/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public function delete(): bool

try {
$this->getClient()
->delete($this->getPath());
->delete($this->getPath($this->getKey()));

return true;
} catch (GuzzleException $e) {
Expand Down
Loading