Refactor subscription handling logic in middleware and model

This commit is contained in:
Andras Bacsai 2024-02-23 13:50:48 +01:00
parent f78fd212bb
commit 3b942049a2
2 changed files with 1 additions and 2 deletions

View File

@ -44,7 +44,7 @@ public function handle(Request $request, Closure $next): Response
if (auth()->user()->hasVerifiedEmail() && $request->path() === 'verify') {
return redirect(RouteServiceProvider::HOME);
}
if (isSubscriptionActive() && $request->path() === 'subscription') {
if (isSubscriptionActive() && $request->routeIs('subscription.index')) {
return redirect(RouteServiceProvider::HOME);
}
return $next($request);

View File

@ -54,7 +54,6 @@ public function type()
};
})->first();
if ($stripePlanId) {
raY($stripePlanId);
return str($stripePlanId)->after('stripe_price_id_')->before('_')->lower();
}
}