setTable(config('ibrand.app.database.prefix', 'ibrand_') . 'order_item'); parent::__construct($attributes); } public function getTotal() { return $this->total; } public function recalculateAdjustmentsTotal() { $this->adjustments_total = $this->divide_order_discount + $this->item_discount; $this->recalculateTotal(); } public function recalculateTotal() { $this->total = $this->units_total + $this->adjustments_total; if ($this->total < 0) { $this->total = 0; } if (null !== $this->order) { $this->order->recalculateItemsTotal(); } } }