mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-28 17:03:59 +00:00
Wallet operations
This commit is contained in:
+23
-5
@@ -2,16 +2,34 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
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
|
||||
{
|
||||
protected $table = 'wallets';
|
||||
use SoftDeletes;
|
||||
|
||||
public function company(): HasOne
|
||||
protected $table = 'wallets';
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
||||
*/
|
||||
public function owner(): morphTo
|
||||
{
|
||||
return $this->hasOne(Company::class, 'company_id', 'id');
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user