belongsTo(\App\Models\Customer::class); } public function payment() { return $this->belongsTo(\App\Models\Payment::class, 'payment_id', 'id'); } public function invoiceItem() { return $this->hasMany(\App\Models\InvoiceItem::class)->with(['addons.addonItems', 'hosting', 'vps', 'os']); } public function order() { return $this->belongsTo(\App\Models\Order::class, 'id', 'invoice_id'); } public function attachments() { return $this->hasMany(\App\Models\InvoiceAttachment::class); } public function getStatus() { return match ($this->attributes['status']) { 1 => 'Chưa thanh toán', 2 => 'Đã thanh toán', default => 'Đã hủy' }; } public function getStatusLabelAttribute(): string { return InvoiceStatus::from($this->status)->label(); } }