mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-21 23:05:05 +00:00
Renamed migration file
Fixed migration being published multiple times Added more tests Fixed setGlobalTax and setGlobalDiscount
This commit is contained in:
12
src/Cart.php
12
src/Cart.php
@@ -459,8 +459,10 @@ class Cart
|
||||
public function setGlobalTax($taxRate)
|
||||
{
|
||||
$this->taxRate = $taxRate;
|
||||
if ($this->content && $this->content->count()) {
|
||||
$this->content->each(function ($item, $key) {
|
||||
|
||||
$content = $this->getContent();
|
||||
if ($content && $content->count()) {
|
||||
$content->each(function ($item, $key) {
|
||||
$item->setTaxRate($this->taxRate);
|
||||
});
|
||||
}
|
||||
@@ -495,8 +497,10 @@ class Cart
|
||||
public function setGlobalDiscount($discount)
|
||||
{
|
||||
$this->discount = $discount;
|
||||
if ($this->content && $this->content->count()) {
|
||||
$this->content->each(function ($item, $key) {
|
||||
|
||||
$content = $this->getContent();
|
||||
if ($content && $content->count()) {
|
||||
$content->each(function ($item, $key) {
|
||||
$item->setDiscountRate($this->discount);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user