mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-11 18:54:33 +00:00
Merge pull request #160 from bumbummen99/refactor-moneyphp
Refactor moneyphp
This commit is contained in:
@@ -54,4 +54,16 @@ trait CanBeBought
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the taxRate of the Buyable item.
|
||||||
|
*/
|
||||||
|
public function getBuyableTaxRate(CartItemOptions $options): float
|
||||||
|
{
|
||||||
|
if (($taxRate = $this->getAttribute('taxRate'))) {
|
||||||
|
return $taxRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
return config('cart.tax', 0.21);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,4 +28,9 @@ interface Buyable
|
|||||||
* Get the weight of the Buyable item.
|
* Get the weight of the Buyable item.
|
||||||
*/
|
*/
|
||||||
public function getBuyableWeight(CartItemOptions $options): int;
|
public function getBuyableWeight(CartItemOptions $options): int;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the taxRate of the Buyable item.
|
||||||
|
*/
|
||||||
|
public function getBuyableTaxRate(CartItemOptions $options): float;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,4 +68,9 @@ class BuyableProduct extends Model implements Buyable
|
|||||||
{
|
{
|
||||||
return $this->weight;
|
return $this->weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBuyableTaxRate(CartItemOptions $options): float
|
||||||
|
{
|
||||||
|
return $this->tax_rate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user