'integer', 'unit_price' => 'integer', 'total_amount' => 'integer', 'billed_at' => 'date', ]; // ========================================================================= // 관계 정의 // ========================================================================= public function member(): BelongsTo { return $this->belongsTo(BarobillMember::class, 'member_id'); } // ========================================================================= // 스코프 // ========================================================================= public function scopeOfMonth($query, string $billingMonth) { return $query->where('billing_month', $billingMonth); } public function scopeSubscription($query) { return $query->where('billing_type', 'subscription'); } public function scopeUsage($query) { return $query->where('billing_type', 'usage'); } public function scopeOfService($query, string $serviceType) { return $query->where('service_type', $serviceType); } // ========================================================================= // 접근자 // ========================================================================= public function getServiceTypeLabelAttribute(): string { return match ($this->service_type) { 'tax_invoice' => '전자세금계산서', 'bank_account' => '계좌조회', 'card' => '카드조회', 'hometax' => '홈택스', default => $this->service_type, }; } }