改进 验证
This commit is contained in:
parent
a5a1c7aad5
commit
8ccb270591
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Observers;
|
namespace App\Observers;
|
||||||
|
|
||||||
|
use App\Models\Affiliate\Affiliates;
|
||||||
use App\Models\Affiliate\AffiliateUser;
|
use App\Models\Affiliate\AffiliateUser;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Crypt;
|
use Illuminate\Support\Facades\Crypt;
|
||||||
@ -22,7 +23,10 @@ public function creating(User $user): void
|
|||||||
|
|
||||||
// if session has affiliate_id, then set it to user
|
// if session has affiliate_id, then set it to user
|
||||||
if (session()->has('affiliate_id')) {
|
if (session()->has('affiliate_id')) {
|
||||||
$user->affiliate_id = session()->get('affiliate_id');
|
$affiliate_id = session()->get('affiliate_id');
|
||||||
|
if (Affiliates::find($affiliate_id)) {
|
||||||
|
$user->affiliate_id = session()->get('affiliate_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user