mirror of
https://github.com/wearepixel/laravel-cart.git
synced 2026-11-14 13:51:44 +00:00
feat: finish tests & docs
This commit is contained in:
+15
-12
@@ -268,18 +268,26 @@ public function remove($id)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* clear cart
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
if ($this->fireEvent('Clearing') === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->session->putItems([]);
|
||||
$this->session->clear();
|
||||
|
||||
$this->fireEvent('Cleared');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function clearItems()
|
||||
{
|
||||
if ($this->fireEvent('Clearing') === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->session->clearItems();
|
||||
|
||||
$this->fireEvent('Cleared');
|
||||
|
||||
@@ -654,12 +662,7 @@ public function getContent(): CartCollection
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* check if cart is empty
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmpty()
|
||||
public function isEmpty($test = null)
|
||||
{
|
||||
return $this->getContent()->isEmpty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user