Files
sam-api/app/Models/Barobill/BarobillMonthlySummary.php

54 lines
1.5 KiB
PHP
Raw Normal View History

<?php
namespace App\Models\Barobill;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class BarobillMonthlySummary extends Model
{
protected $table = 'barobill_monthly_summaries';
protected $fillable = [
'member_id',
'billing_month',
'bank_account_fee',
'card_fee',
'hometax_fee',
'subscription_total',
'tax_invoice_count',
'tax_invoice_amount',
'usage_total',
'grand_total',
];
protected $casts = [
'bank_account_fee' => 'integer',
'card_fee' => 'integer',
'hometax_fee' => 'integer',
'subscription_total' => 'integer',
'tax_invoice_count' => 'integer',
'tax_invoice_amount' => 'integer',
'usage_total' => 'integer',
'grand_total' => 'integer',
];
// =========================================================================
// 관계 정의
// =========================================================================
public function member(): BelongsTo
{
return $this->belongsTo(BarobillMember::class, 'member_id');
}
// =========================================================================
// 스코프
// =========================================================================
public function scopeOfMonth($query, string $billingMonth)
{
return $query->where('billing_month', $billingMonth);
}
}