tahesab 2
This commit is contained in:
@@ -100,6 +100,19 @@ class Customer extends Authenticatable implements JWTSubject
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user