Files
InvoiceShelf/app/Domains/Receivables/Models/PaymentAllocation.php
T

42 lines
900 B
PHP

<?php
namespace App\Domains\Receivables\Models;
use App\Domains\Sales\Models\Invoice;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class PaymentAllocation extends Model
{
protected $table = 'payment_allocations';
use HasFactory;
protected $guarded = ['id'];
protected function casts(): array
{
return [
'amount' => 'integer',
'base_amount' => 'integer',
];
}
/**
* The receipt this slice was taken out of.
*/
public function payment(): BelongsTo
{
return $this->belongsTo(Payment::class, 'payment_id');
}
/**
* The document this slice was booked against.
*/
public function invoice(): BelongsTo
{
return $this->belongsTo(Invoice::class, 'invoice_id');
}
}