split router

This commit is contained in:
Tokumeikoi
2020-02-01 20:51:45 +08:00
parent ab5aeb545e
commit 1d704a4424
9 changed files with 214 additions and 84 deletions

View File

@ -36,7 +36,6 @@ class RouteServiceProvider extends ServiceProvider
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
//
@ -65,9 +64,14 @@ class RouteServiceProvider extends ServiceProvider
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::group([
'prefix' => 'api/v1',
'middleware' => 'api',
'namespace' => $this->namespace
], function ($router) {
foreach (glob(app_path('Http//Routes') . '/*.php') as $file) {
$this->app->make('App\\Http\\Routes\\' . basename($file, '.php'))->map($router);
}
});
}
}