inspiren-sem-tool/app/Models/ClientInvoicePaymentItem.php

48 lines
1.2 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ClientInvoicePaymentItem extends Model
{
public $timestamps = false;
protected $fillable = [
'client_invoice_payment_id',
'billing_item_types_id',
'start_date',
'end_date',
'payment_item_amount',
'tax_percentage',
'net_amount',
'withholding_tax',
'final_net_amount',
'spending',
'is_creditcard',
];
protected $casts = [
'start_date' => 'date',
'end_date' => 'date',
'payment_item_amount' => 'decimal:6',
'tax_percentage' => 'decimal:2',
'net_amount' => 'decimal:6',
'withholding_tax' => 'decimal:2',
'final_net_amount' => 'decimal:6',
'spending' => 'decimal:6',
'is_creditcard' => 'boolean',
];
public function payment(): BelongsTo
{
return $this->belongsTo(ClientInvoicePayment::class, 'client_invoice_payment_id');
}
public function billingItemType(): BelongsTo
{
return $this->belongsTo(BillingItemType::class, 'billing_item_types_id');
}
}