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

afoster009's avatar

Only allow Subscribed Users to Create Teams

Hello, i am wondering how i would block all of the team routes for users who are not subscribed. I assume i could use

Route::get('/paid', ['middleware' => 'subscribed', function () {
    //
}]);

to some extend but it there a way to just grab all of the routes that have to do with teams and block them until a user subscribes to a plan?

Thanks in advance!!

0 likes
4 replies
bobbybouwmann's avatar

You can use route groups for that right?

// Other routes here

Route::group(['middleware' => 'subscribed'], function () {
    // All routes here where you need to be subscribed.
});
afoster009's avatar

That's what I figured as well, haven't gave it a shot yet though, I'd rather just grab them all in one fell swoop though instead of listing them all out in there :(

bobbybouwmann's avatar

You can use Route::resource in the Route::group if you wish. Not really sure what you mean in "one fell swoop".

Anyway, I always like to be specific about my routes because it's the starting point of your application

Please or to participate in this conversation.