multiple route file instead of one main route file in laravel 5

前端 未结 9 1135
广开言路
广开言路 2020-12-15 12:58

I am a novice in web developing with Laravel 5. I installed asGgardCMS and After seeing asgardCms codes, I found that there is nothing codes in app/Http/route.php file and r

9条回答
  •  难免孤独
    2020-12-15 13:21

    1. create 2 route files routes.web.php and routes.api.php.

    2. edit the RouteServiceProvider.php file to look like the example below:


    group(['namespace' => $this->webNamespace], function ($router) {
                require app_path('Http/routes.web.php');
            });
    
            /*
            |--------------------------------------------------------------------------
            | Api Router 
            |--------------------------------------------------------------------------
            */
    
            $router->group(['namespace' => $this->apiNamespace], function ($router) {
                require app_path('Http/routes.api.php');
            });
    
        }
    }
    

    Note: you can add as many route files as you want...

提交回复
热议问题