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

MatthewStanford's avatar

Spark Condition Multi Level Access Based on Payment Plan

I am getting pretty far into my application and now I have a dilemma. I want to have multiple layers of Access. So I know spark has the subscribed middleware. But I would like to not only check that but in views have different stripe plan level access. I think the sudo code would go like this.

// you can not access a route if you do not have a pro account ... "I think I would do this with middleware on the controller for each specific plan level*\

// In the dashboard for simple navigation purposes and possibly other views in the future I would like to have re useable code that will conditionally grant access.. ie.. if user is pro->give free, basic and pro access if user is basic->give free, basic access if user is free->give user free access *\

I cant figure out which way to go. I like a few different options such as @if (Gate::allows('admin')) .. But i do not know about making that conditional per example above.

I have also been researching blade directives so I can use something like

@subscribed @unsubscribed

Bummer! Looks like you need a subscription to access this video.

@endsubscribed

src .. https://scotch.io/tutorials/all-about-writing-custom-blade-directives

I would appreciate any input. Thanks!

0 likes
0 replies

Please or to participate in this conversation.