tahesab 2

This commit is contained in:
2026-06-07 18:27:04 +03:30
parent 20ed4ee3ad
commit 484f05a073
6 changed files with 398 additions and 88 deletions
+13
View File
@@ -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);