'int', 'homeparty_user_id' => 'int', 'product_id' => 'int', 'qty' => 'int', 'price' => 'float', 'price_net' => 'float', 'tax_rate' => 'float', 'points' => 'int', 'margin' => 'float', 'ek-price' => 'float' ]; protected $fillable = [ 'homeparty_id', 'homeparty_user_id', 'product_id', 'qty', 'price', 'price_net', 'tax_rate', 'points', 'margin', 'ek-price', 'slug' ]; public function homeparty() { return $this->belongsTo(Homeparty::class); } public function homeparty_user() { return $this->belongsTo(HomepartyUser::class); } public function product() { return $this->belongsTo(Product::class); } public function getFormattedPrice() { return formatNumber($this->attributes['price']); } public function getFormattedTotalPrice() { return formatNumber($this->attributes['price'] * $this->attributes['qty']); } public function getFormattedPriceNet() { return formatNumber($this->attributes['price_net']); } public function getFormattedTotalPriceNet() { return formatNumber($this->attributes['price_net'] * $this->attributes['qty']); } public function getFormattedEKPrice() { return formatNumber($this->attributes['ek-price']); } public function getFormattedTotalEKPrice() { return formatNumber($this->attributes['ek-price'] * $this->attributes['qty']); } public function getFormattedIncomePrice() { return formatNumber($this->attributes['price'] - $this->attributes['ek-price']); } public function getFormattedTotalIncomePrice() { return formatNumber(($this->attributes['price'] - $this->attributes['ek-price']) * $this->attributes['qty']); } public function getFormattedTotalPoints() { return formatNumber($this->attributes['points'] * $this->attributes['qty'], 0); } public function getTotalPrice() { return (float) ($this->attributes['price'] * $this->attributes['qty']); } public function getTotalPoints() { return ($this->attributes['points'] * $this->attributes['qty']); } public function geTotalPriceNet() { return (float) ($this->attributes['price_net'] * $this->attributes['qty']); } public function geTotalEKPrice() { return (float) ($this->attributes['ek-price'] * $this->attributes['qty']); } public function getIncomePrice() { return (float) ($this->attributes['price'] - $this->attributes['ek-price']); } public function geTotalIncomePrice() { return (float) (($this->attributes['price'] - $this->attributes['ek-price']) * $this->attributes['qty']); } }