/** * @param RouteCollection $routes * @return void */ public function transform(RouteCollection $routes) { foreach ($routes->getRoutes() as $route) { $options = $route->getOptions(); $route = Route::match([$route->getHttpMethod()], $route->getPath(), $route->getAction()); if (isset($options['middleware'])) { $route->middleware($options['middleware']); } } }