Support the ongoing development of Laravel.io →
Requests Laravel Session
Last updated 1 year ago.
0

public function handle($request, Closure $next, $guard = null) {

if (!Auth::guard($guard)->guest()) {

    if ($this->getCookie('a_p')) {
        return $next($request);
    } else {
        $AccountPlan = \App\User::GetUserSubscriptionType();
        if (!$AccountPlan) {
            $user_diff = \App\User::IfUserTrial();
            if ($user_diff) {
                $AccountPlan['plan_id']   = 'trial';
                $AccountPlan['days_left'] = $user_diff;
            } else {
                $AccountPlan['plan_id'] = false;
            }
        }
        $this->createCookie();
        return $next($request);
    }
}

}

protected function createCookie($AccountPlan) { return Cookie::queue(Cookie::make('a_p', $AccountPlan, 129600)); }

protected function getCookie($cookie_name) { $cookie_exist = Cookie::get($cookie_name); return ($cookie_exist) ? true : false; }

By:Xtreem Solution

Top laravel web developers

Dedicated PHP Developer

0

Sign in to participate in this thread!

Eventy

Your banner here too?

jerodev jerodev Joined 20 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.