26 lines
486 B
PHP
26 lines
486 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Wallet extends Model
|
|
{
|
|
protected $guarded = ['id'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['available_balance' => 'decimal:2', 'pending_balance' => 'decimal:2', 'locked_balance' => 'decimal:2'];
|
|
}
|
|
|
|
public function owner()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
public function ledgerEntries()
|
|
{
|
|
return $this->hasMany(WalletLedgerEntry::class);
|
|
}
|
|
}
|