You could even look that up (check the db) anywhere, including the controller method prior to loading any game, it's just a check. Why would you need middleware.
Aug 21, 2020
2
Level 63
Middleware to test something else than User
Hello,
Is it possible to use a middleware to test for example if the registrations are open for a game ?
if (! $game->registrationsAreOpen())
{
return redirect()->...
}
return $next($request);
I have checked the documentation, but I do not understand how it could be possible to add a parameter like $game (which could be the game that is used at the moment in the code). It seems that the middleware can only use the $user variable to check something about the connected user.
Thanks for your answer.
Vincent
Level 75
1 like
Please or to participate in this conversation.