Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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


What I have tried:

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',
                    ]);
        }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900