belongsTo(Account::class); } public function items() { return $this->hasMany(PaymentItem::class); } /* ATTRIBUTES */ /** * @return mixed * @deprecated use date_payment directly. */ public function getDatePaidAttribute() { return $this->date_payment->format('Y-m-d'); } /** * Payment Local ID * * @return string */ public function getLIDattribute(): string { return sprintf('%06s',$this->id); } /** * Payment System ID * * @return string */ public function getSIDAttribute(): string { return sprintf('%02s-%04s#%s',$this->site_id,$this->account_id,$this->getLIDattribute()); } public function getTotalAttribute() { return sprintf('%3.'.$this->currency()->rounding.'f',$this->total_amt); } public function currency() { return $this->account->country->currency; } }