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 = ',') 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);
} }
/** /**
@@ -266,6 +266,10 @@ class CartItem implements Arrayable
return $this->price * ($this->taxRate / 100); return $this->price * ($this->taxRate / 100);
} }
if($attribute === 'taxTotal') {
return $this->tax * $this->qty;
}
if($attribute === 'model') { if($attribute === 'model') {
return with(new $this->associatedModel)->find($this->id); return with(new $this->associatedModel)->find($this->id);
} }