I have a project with a few packages that have routes. I have a staging/demo environment that needs to be publicly accessible.
Is there a way to require the auth middleware (or something similar) for all routes without putting it on all of the individual routes and route groups? (Thinking something in bootstrap??)
If you want a middleware to run during every HTTP request to your application, simply list the middleware class in the
$middleware
property of yourapp/Http/Kernel.php
class.If you do not have access, or do not want, to modify the package controllers, you can create a Middleware (recommend inheriting from
AuthenticateSession
. For example:Then
Kernal.php
looks like this: