customer_id); $paylater = $customer->paylater; $paylater->update(['usage' => $paylater->usage + $this->debit - $this->credit]); } public function formatHumanCreatedAt(): Attribute { return Attribute::make(get: function () { return Carbon::parse($this->created_at)->locale('id')->translatedFormat('d F Y'); }); } public function formatCreatedAt(): Attribute { return Attribute::make(get: function () { return Carbon::parse($this->created_at)->locale('id')->translatedFormat('d F Y H:i:s'); }); } public function amount(): Attribute { return Attribute::make(get: function () { if ($this->credit == 0) { return 'Rp' . number_format($this->debit, 0, ',', '.'); } return '-Rp' . number_format($this->credit, 0, ',', '.'); }); } }