Skip to the content.

Creating a middleware

To create a middleware, we use the “php artisan make:module:middleware ModuleName middlewareName” command.

php artisan make:module:middleware blog BlogMiddleware

This will create a middleware in the path modules/blog/src/Http/Middleware/BlogMiddleware.php