CodeIgniter Laravel PHP Example HTML Javascript jQuery MORE Videos New
Need a Website Or Web Application.Contact : +91 9437911966 (Whatsapp) Note: Paid Service

How to create custom Middleware in laravel

  1. run command in terminal
    php artisan make:middleware PermissionCheck go to app/Http/Middleware and open the PermissionCheck.php file there is handle(Request $request, Closure $next) method. we have to write the code in this function.
  2. open Kernel.php which is inside under app/Http folder
    add 'permission_check' => \App\Http\Middleware\PermissionCheck::class, inside routeMiddleware list
  3. use $this->middleware('permission_check'); statement to load middleware.