src/Routing/Router.php
protected function prepareRoutes()
    {
        $this->dispatcher = \FastRoute\simpleDispatcher(function (\FastRoute\RouteCollector $collector) {
            $router = new RouteCollection($this, $collector, '', [], '');

            // API
            $router->group(['middlewares' => ['api']], function (RouteCollection $router) {
                $route_file = app_path('routes_api.php');
                if (file_exists($route_file)) {
                    require $route_file;
                }
            });

            // WEB
            $router->group(['middlewares' => ['web']], function (RouteCollection $router) {
                $route_file = app_path('routes.php');
                if (file_exists($route_file)) {
                    require $route_file;
                }
            });
        });
    }
protected function prepareRoutes()
    {
        $this->dispatcher = \FastRoute\simpleDispatcher(function (\FastRoute\RouteCollector $collector) {
            $router = new RouteCollection($this, $collector, '', [], '');

            // API
            $router->group(['middlewares' => ['api']], function (RouteCollection $router) {
                $route_file = app_path('routes_api.php');
                if (file_exists($route_file)) {
                    require $route_file;
                }
            });

            // WEB
            $router->group(['middlewares' => ['web']], function (RouteCollection $router) {
                $route_file = app_path('routes.php');
                if (file_exists($route_file)) {
                    require $route_file;
                }
            });
        });
    }
protected function prepareRoutes ( ) { $ this -> dispatcher = \ FastRoute \ simpleDispatcher ( function ( \ FastRoute \ RouteCollector $ collector ) { $ router = new RouteCollection ( $ this , $ collector , '' , [ ] , '' ) ; // API $ router -> group ( [ 'middlewares' => [ 'api' ] ] , function ( RouteCollection $ router ) { $ route_file = app_path ( 'routes_api.php' ) ; if ( file_exists ( $ route_file ) ) { require $ route_file ; } } ) ; // WEB $ router -> group ( [ 'middlewares' => [ 'web' ] ] , function ( RouteCollection $ router ) { $ route_file = app_path ( 'routes.php' ) ; if ( file_exists ( $ route_file ) ) { require $ route_file ; } } ) ; } ) ; }
Carregar e preparar rotas.
Carregar e preparar rotas .