attributes['amount'] + 0; } /********* * Relations * */ public function installment() { return $this->belongsTo(Installment::class, 'installment_id', 'id'); } /********* * Helpers * */ public function getPrice($itemPrice = 1) { if ($this->amount_type == 'percent') { return ($itemPrice * $this->amount) / 100; } else { return $this->amount; } } public function getDeadlineTitle($itemPrice = 1) { $percentText = ($this->amount_type == 'percent') ? "({$this->amount}%)" : ''; // $100 after 30 days return trans('update.amount_after_n_days', ['amount' => handlePrice($this->getPrice($itemPrice)), 'days' => $this->deadline, 'percent' => $percentText]); } }