belongsTo(Invoice::class, 'invoice_id'); } public function product() { return $this->belongsTo(Product::class, 'product_id'); } // ------------------------------------------------------------------------- // Helpers // ------------------------------------------------------------------------- public function getBillingLabelAttribute(): string { return match ((int) $this->months) { 0 => 'One Time', 1 => 'Monthly', 3 => 'Quarterly', 6 => 'Semi-Annually', 12 => 'Annually', 24 => '2 Years', 36 => '3 Years', default => $this->months . ' Months', }; } public function getTypeLabelAttribute(): string { return match ($this->type) { 'service' => 'Dịch vụ', 'addon' => 'Addon', 'upgrade' => 'Nâng cấp', default => ucfirst($this->type), }; } }