Added: taxTotal format method

This commit is contained in:
Matus Rohal
2016-06-23 12:35:20 +02:00
parent fb19422a9e
commit 04f6e6bf40

View File

@@ -168,7 +168,7 @@ class CartItem implements Arrayable
*/
public function taxTotal($decimals = 2, $decimalPoint = '.', $thousandSeperator = ',')
{
return number_format(($this->tax * $this->qty), $decimals, $decimalPoint, $thousandSeperator);
return number_format($this->taxTotal, $decimals, $decimalPoint, $thousandSeperator);
}
/**
@@ -265,6 +265,10 @@ class CartItem implements Arrayable
if($attribute === 'tax') {
return $this->price * ($this->taxRate / 100);
}
if($attribute === 'taxTotal') {
return $this->tax * $this->qty;
}
if($attribute === 'model') {
return with(new $this->associatedModel)->find($this->id);