Refactor subscription handling logic in middleware and model
This commit is contained in:
parent
f78fd212bb
commit
3b942049a2
@ -44,7 +44,7 @@ class DecideWhatToDoWithUser
|
|||||||
if (auth()->user()->hasVerifiedEmail() && $request->path() === 'verify') {
|
if (auth()->user()->hasVerifiedEmail() && $request->path() === 'verify') {
|
||||||
return redirect(RouteServiceProvider::HOME);
|
return redirect(RouteServiceProvider::HOME);
|
||||||
}
|
}
|
||||||
if (isSubscriptionActive() && $request->path() === 'subscription') {
|
if (isSubscriptionActive() && $request->routeIs('subscription.index')) {
|
||||||
return redirect(RouteServiceProvider::HOME);
|
return redirect(RouteServiceProvider::HOME);
|
||||||
}
|
}
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
@ -54,7 +54,6 @@ class Subscription extends Model
|
|||||||
};
|
};
|
||||||
})->first();
|
})->first();
|
||||||
if ($stripePlanId) {
|
if ($stripePlanId) {
|
||||||
raY($stripePlanId);
|
|
||||||
return str($stripePlanId)->after('stripe_price_id_')->before('_')->lower();
|
return str($stripePlanId)->after('stripe_price_id_')->before('_')->lower();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user