Files
boursecu_server/packages/rooyesh/wallet/src/models/Wallet.php
T
2026-07-01 20:59:24 +03:30

34 lines
837 B
PHP

<?php
namespace Rooyesh\Wallet\models;
use App\Models\Selector;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Wallet extends Model
{
protected $guarded=['hash'];
use Selector;
use HasFactory;
public function customer()
{
return $this->belongsTo('App\Models\Customer','owner')->select(['id','name','mobile']);
}
public function fund()
{
return $this->belongsTo('App\Models\Fund','fund_id')->select(['id','title']);
}
public function product()
{
return $this->belongsTo('App\Models\Product', 'product_id');
}
/** کیف اصلی مشتری — بدون fund و بدون product */
public function scopeMain($query)
{
return $query->whereNull('fund_id')->whereNull('product_id');
}
}