mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-27 00:13:59 +00:00
code for statement import invoice mapping
This commit is contained in:
@@ -18,6 +18,7 @@ use Illuminate\Database\Eloquent\Relations\HasOneThrough;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasTableAlias;
|
||||
use App\Models\StatementTransactionOwner;
|
||||
|
||||
|
||||
class Transaction extends AbstractModel implements Documentable, Transactionable, Voucherifiable
|
||||
@@ -53,6 +54,14 @@ class Transaction extends AbstractModel implements Documentable, Transactionable
|
||||
return $this->MorphOne(Transaction::class, 'owner')->where('type', TransactionType::CREDIT_NOTE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphOne
|
||||
*/
|
||||
public function transaction_owner()
|
||||
{
|
||||
return $this->MorphOne(StatementTransactionOwner::class, 'owner','owner_type','owner_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
@@ -69,6 +78,16 @@ class Transaction extends AbstractModel implements Documentable, Transactionable
|
||||
return $this->BelongsTo( Company::class, 'issuer', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user that owns the Transaction
|
||||
*
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function receiverCompany(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Company::class, 'receiver', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user