Registering Middleware in Laravel 5.4 using aliasMiddlewareFebruary 17, 2017
Registering a new custom middleware on Laravel from service provider is too easy. Previously while working on Laravel 5.3 you could register a middleware by calling the
When you call the above function, Laravel behind the hood calls the
Router.php file on
Illuminate\Routing\Router and calls the below function.
Above function simply registers the new middleware that you have passed through
Route::middleware function on service provider.
On Laravel 5.4, this middleware function has been renamed as
So, on Laravel 5.4 you must register a middleware using the aliasMiddleware like the following