As you see each middleware has an alias.
Later, I will tell you how to make your project modular. Stay tuned!
And if you want to create a new middleware, you should create it inside
Http/Middleware directory and then register it in
kernel.php as you see above.
The question is if we make our project modular and every file and directory of the project are inside a custom domain directory, how we should register the middleware?
Or if we are making a package and it has its
service provider how we can register the middleware inside the
The solution is to put this line inside the
register() method of our package
serviceprovider. and fill it properly with the correct key and value.
As an example we put for then key the alias and for the value the full string of the class name.