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

Max13's avatar
Level 3

Overload Spark's Settings\DashboardController ignoring middleware

I would like to implement my own 2FA (two factor authentication) on a fresh Spark install.

First thing, as I don't need phone and country code, I extend Laravel\Spark\Http\Controllers\Settings\DashboardController to my own App\Http\Controllers\Settings\DashboardController and add its route to routes/web.php.

The thing is, every route registered in routes/web.php automatically get the hasTeam middleware (because I want my users to have a team), and for a freshly registered user, he doesn't have one so my DashboardController forces the user to create a team, then as it's shows the DashboardController, the user is locked there and can't even create a team.

My question is: Is there a way to add a route to routes/web.php but removing the hasTeam middleware? If not, how can I overload/create a route without the hasTeam middleware set by the RouteServiceProvider?

Thanks for your help

0 likes
1 reply
steve_laracasts's avatar

This sounds a bit messed up, if there is no team for the user they should be redirected to the create team page - not get stuck on the dashboard where they can't do anything.

As far as I know if you enable teams the user must create a team before doing anything else.

By that I mean to say that you're not going to have much fun trying to remove this requirement and still use teams - it's pretty deeply embedded from what I have worked out in the code so far.

Please or to participate in this conversation.