'int', 'price' => 'float', 'price_net' => 'float', 'tax_rate' => 'float', 'tax' => 'float', 'price_vk_net' => 'float', 'discount' => 'float', 'points' => 'float', 'is_abo_addon' => 'bool', ]; public function shopping_order() { return $this->belongsTo('App\Models\ShoppingOrder', 'shopping_order_id'); } /** * Reine Abo-Positionen (keine einmalig hinzugefügten Artikel). */ public function scopeAboItems($query) { return $query->where('is_abo_addon', false); } /** * Einmalig zum Abo-Versand hinzugefügte Artikel aus dem normalen Bestellsortiment. */ public function scopeAddonItems($query) { return $query->where('is_abo_addon', true); } public function product() { return $this->belongsTo('App\Models\Product', 'product_id'); } public function homeparty() { return $this->belongsTo('App\Models\Homeparty', 'homeparty_id'); } 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 getFormattedPriceVkNet() { return formatNumber($this->attributes['price_vk_net']); } public function getFormattedTaxRate() { return cleanNumberFormat($this->attributes['tax_rate']); } public function getTaxRate() { return formatNumber($this->attributes['tax']); } public function getFormattedDiscount() { return cleanNumberFormat($this->attributes['discount']); } public function getFormattedTotalPriceNet() { return formatNumber($this->attributes['price_net'] * $this->attributes['qty']); } public function setPointsAttribute($value) { $this->attributes['points'] = $value !== null ? \Util::reFormatNumber($value) : null; } public function getFormattedPoints() { return isset($this->attributes['points']) ? formatNumber($this->attributes['points']) : ''; } }