belongsTo('App\Models\Sale\Invoice'); } public function item() { return $this->belongsToThrough('App\Models\Common\Item', 'App\Models\Sale\InvoiceItem', 'invoice_item_id')->withDefault(['name' => trans('general.na')]); } public function tax() { return $this->belongsTo('App\Models\Setting\Tax')->withDefault(['name' => trans('general.na'), 'rate' => 0]); } /** * Convert amount to double. * * @param string $value * @return void */ public function setAmountAttribute($value) { $this->attributes['amount'] = (double) $value; } }