Ok so am trying to build a referral system using the OAuth system, am working with the laravel framework. So when a user vist the registration page with a referral link it create a cookie and a session. for to register all that is provided is the social button. so whenever the user clicks on the register with google or facebook. Once the user comes back to the site the session and cookie disappear. Why is that? below are the files i think may be helpful Where I created the session and cookie base on the ref please i need assitance
if ($request->has('ref')){ $referral = ReferralLink::whereCode($request->get('ref'))->first(); $response->cookie('ref', $referral->user_id, $referral->program->lifetime_minutes); $_SESSION['ref'] = $referral->user_id; request()->session()->put('ref', $referral->user_id); } Where I retrive the session and cookie base on the ref $session = request()->session()->get('ref'); dd(request()); $referral = \App\User\ReferralLink::where('user_id', $event->referralId)->orWhere('user_id', $session)->first(); // dd($event->user, $event->referralId, $referral); if (!is_null($referral)){ $provider = $referral->user; \App\User\ReferralRelationship::create([ 'referral_link_id' => $referral->id, 'user_id' => $event->user->id, 'referree_user_id' => $provider->id, 'reward' => 'no', ]); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)