mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-19 12:34:24 +00:00
56 lines
1.2 KiB
PHP
56 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Classes\General\Interfaces\Documentable;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
|
|
|
|
|
class Transaction extends AbstractModel implements Documentable
|
|
{
|
|
protected $table = 'transactions';
|
|
|
|
/**
|
|
* @return BelongsTo
|
|
*/
|
|
public function booking(): BelongsTo
|
|
{
|
|
return $this->BelongsTo( booking::class, 'booking_id', 'id');
|
|
}
|
|
|
|
/**
|
|
* @return MorphMany
|
|
*/
|
|
public function documents(): morphMany
|
|
{
|
|
return $this->morphMany(Document::class, 'owner');
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo
|
|
*/
|
|
public function currency(): BelongsTo
|
|
{
|
|
return $this->BelongsTo(Currency::class, 'currency_id', 'id');
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo
|
|
*/
|
|
public function original_currency(): BelongsTo
|
|
{
|
|
return $this->BelongsTo(Currency::class, 'original_currency_id', 'id');
|
|
}
|
|
|
|
/**
|
|
* @return HasMany
|
|
*/
|
|
public function transactionDetails(): HasMany
|
|
{
|
|
return $this->HasMany(TransactionDetail::class, 'transaction_id', 'id');
|
|
}
|
|
|
|
}
|