Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Marcolino922's avatar

Play with subscription restrictions

Hi, I'm going crazy testing the logic of restrictions via subscriptions with Stripe.

Coming to the point, I would like to manage content through subscriptions that have this logic:

  1. [If the user is logged in and has a subscription] [If the user has canceled his subscription but is still in the trial period]

2 [If the user has an expired or terminated subscription with immediate expiry]

3 [Finally, if he is a visitor]

I made a small draft to give an idea, but it seems that if I instantly terminate the subscription for a user (therefore with the immediate expiration which is therefore to be considered expired), it does not show the warning that it has expired.

@if(Auth::check() && Auth::user()->subscribed('default') || Auth::user()->subscription('default')->onGracePeriod())

[If the user is logged in and has a subscription] 
[If the user has canceled his subscription but is still in the trial period]

@elseif(Auth::check() && Auth::user()->subscribed('default') && Auth::user()->subscription('default')->ended())

[If the user has an expired or terminated subscription with immediate expiry]

@else

[guest]

@endif

0 likes
0 replies

Please or to participate in this conversation.