Questions tagged [laravel-middleware]

HTTPl Middleware is a mechanism for filtering HTTP requests that are passing through your application. Middleware allows you to add additional layers around your business logic.

Laravel includes a middleware that verifies the user of your application is authenticated. If the user is not authenticated, the middleware will redirect the user to the login screen. However, if the user is authenticated, the middleware will allow the request to proceed further into the application.

Of course, middleware can be written to perform a variety of tasks besides authentication. A CORS middleware might be responsible for adding the proper headers to all responses leaving your application. A logging middleware might log all incoming requests to your application.

There are several middleware included in the Laravel framework, including middleware for maintenance, authentication, CSRF protection, and more. All of these middleware are located in the app/Http/Middleware directory.

Reference

558 questions
-3
votes
1 answer

how to avoid running burst operations in laravel middleware when refresh

im using laravel middleware (visits) to create visits record in database like this: public function handle(Request $request, Closure $next) { Visit::create([ 'ip' => 'user ip', 'browser' => 'user browser', 'url' =>…
K1-Aria
  • 1,093
  • 4
  • 21
  • 34
-3
votes
1 answer

How can i get this code executed instead of having it appear on the browser? Please assist

@if(\Route::getFacadeRoot()->current()->uri() == 'dashboard' || \Route::getFacadeRoot()->current()->uri() == 'welcome' || \Route::getFacadeRoot()->current()->uri() == 'change-password' || \Route::getFacadeRoot()->current()->uri() ==…
1 2 3
37
38