mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-19 12:34:24 +00:00
36 lines
828 B
PHP
36 lines
828 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
|
|
|
class Wallet extends AbstractModel
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'wallets';
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
|
*/
|
|
public function owner(): morphTo
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
public function company(): BelongsTo
|
|
{
|
|
return $this->BelongsTo(Company::class, 'owner_id', 'id');
|
|
}
|
|
|
|
/**
|
|
* @return morphMany
|
|
*/
|
|
public function transactions(): morphMany
|
|
{
|
|
return $this->morphMany(Transaction::class, 'owner');
|
|
}
|
|
}
|