mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-23 23:51:25 +00:00
Added: taxTotal format method
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user