Files
exchange-2.0/app/Models/StatementTransactionOwner.php

36 lines
856 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class StatementTransactionOwner extends Model
{
use HasFactory;
protected $fillable = [
'statement_transaction_id',
'type',
'system',
'owner_type',
'owner_id',
'owner_reference',
'invoice_reference',
'receipt_reference',
'status',
];
public function transaction(): BelongsTo
{
return $this->belongsTo(StatementTransaction::class, 'statement_transaction_id', 'id');
}
public function scopeGetSiblingsOwner($query) {
$query->where('system', $this->system)
->where('owner_type', $this->owner_type)
->where('owner_id', $this->owner_id);
}
}