"boolean", "gold" => "float", "is_archive" => "boolean", "finger_print" => "boolean", ]; static $TYPE = [ 1=>'همکار', 2=>'خانگی', 3=>'سرمایه گذار' ]; static $TYPES = [ 1=>'همکار', 2=>'خانگی', 3=>'سرمایه گذار' ]; public function setNameAttribute($value = null) { $fname = $this->attributes['fname'] ?? ''; $lname = $this->attributes['lname'] ?? ''; $this->attributes['name'] = trim("$fname $lname"); } public function wallet() { return $this->hasMany(Wallet::class ,'owner')->with(['fund','product'])->select(['cash', 'fund_id','product_id','gold', 'owner']); } public function user() { return $this->belongsTo(User::class)->select(['id','name']); } public function referral() { return $this->belongsTo(Customer::class, 'referral_to_id', 'referral_id'); } /** معرف واقعی — با جستجوی صریح و جلوگیری از برگشت خود کاربر */ public function referrer(): ?self { if (empty($this->referral_to_id)) { return null; } return static::query() ->where('referral_id', $this->referral_to_id) ->where('id', '!=', $this->id) ->first(); } // hash password public function setPasswordAttribute($value){ $this->attributes['password'] = Hash::make($value); } public function getJWTIdentifier() { return $this->getKey(); } public function getJWTCustomClaims() { return []; } public function tahesab() { return $this->hasMany(Tahesab::class, 'customer_id', 'id'); } public function customer_settings() { return $this->hasMany(CustomersSetting::class, 'agent_id'); } public function package() { return $this->belongsTo(Package::class); } public function agent() { return $this->belongsTo(Customer::class, 'agent_id'); } }