'int', 'product_id' => 'int', 'comp' => 'int', 'free_product_id' => 'int', 'qty' => 'int', 'price' => 'float', 'price_net' => 'float', 'tax_rate' => 'float', 'handle' => 'bool', ]; protected $fillable = [ 'shopping_order_id', 'row_id', 'product_id', 'comp', 'free_product_id', 'qty', 'price', 'price_net', 'tax_rate', 'slug', 'handle', ]; public function shopping_order() { return $this->belongsTo('App\Models\ShoppingOrder','shopping_order_id'); } public function product() { return $this->belongsTo('App\Models\Product','product_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 getFormattedTotalPriceNet() { return formatNumber($this->attributes['price_net'] * $this->attributes['qty']); } public function isFreeProduct() { return $this->free_product_id > 0 ? true : false; } public function promotion_user_product() { return $this->belongsTo('App\Models\PromotionUserProduct','free_product_id'); } }