0

I want to apply a middleware to any request to my server

this middleware should check for whitelisted Ips

registering the middleware to each single route is not a perfect solution

what if he navigated to non-implemented route like 404 Page

implemented routes

/r1

/r2

/r3

if he navigated to /4 for example - it will navigate to 404 page , but also in this case - I want to use the middleware

27mdmo7sn
  • 499
  • 2
  • 6
  • 15

1 Answers1

3

https://laravel.com/docs/5.6/middleware#global-middleware

There is dedicated section about this

Global Middleware

If you want a middleware to run during every HTTP request to your application, list the middleware class in the $middleware property of your app/Http/Kernel.php class.

Community
  • 1
  • 1
skyboyer
  • 22,209
  • 7
  • 57
  • 64