- Extend the
Illuminate\Routing\Router
to the (for example)App\Illuminate\Routing\Router
. - Add method
setMiddleware
andsetMiddlewareGroups
to yourApp\Illuminate\Routing\Router
<?php
namespace App\Illuminate\Routing;
use Illuminate\Routing\Router as BaseRouter;