Skip to content

Commit

Permalink
add emptyItems scope
Browse files Browse the repository at this point in the history
  • Loading branch information
milwad-dev committed Jun 29, 2024
1 parent 5f3a5ea commit d934314
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Models/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ public function scopeRemoveItemById(Builder $query, int $id): Builder
return $query;
}

/**
* Scope remove item from cart by id.
*/
public function scopeEmptyItems(Builder $query): Builder
{
$this->items()->delete();

return $query;
}

// Methods

/**
Expand Down

0 comments on commit d934314

Please sign in to comment.