Tiny refactor

This commit is contained in:
Pig Fang 2019-12-20 22:58:04 +08:00
parent fa2048c7bd
commit 4c3b9f0cb6

View File

@ -52,12 +52,9 @@ class RouteServiceProvider extends ServiceProvider
*/ */
protected function mapWebRoutes(Router $router) protected function mapWebRoutes(Router $router)
{ {
$router->group([ Route::middleware(['web'])
'middleware' => ['web'], ->namespace($this->namespace)
'namespace' => $this->namespace, ->group(base_path('routes/web.php'));
], function ($router) {
require base_path('routes/web.php');
});
} }
/** /**
@ -69,9 +66,8 @@ class RouteServiceProvider extends ServiceProvider
*/ */
protected function mapStaticRoutes(Router $router) protected function mapStaticRoutes(Router $router)
{ {
$router->group(['namespace' => $this->namespace], function ($router) { Route::namespace($this->namespace)
require base_path('routes/static.php'); ->group(base_path('routes/static.php'));
});
} }
/** /**
@ -84,10 +80,10 @@ class RouteServiceProvider extends ServiceProvider
protected function mapApiRoutes() protected function mapApiRoutes()
{ {
Route::prefix('api') Route::prefix('api')
->middleware( ->middleware(
config('app.env') == 'testing' ? ['api'] : ['api', 'throttle:60,1'] config('app.env') == 'testing' ? ['api'] : ['api', 'throttle:60,1']
) )
->namespace($this->namespace) ->namespace($this->namespace)
->group(base_path('routes/api.php')); ->group(base_path('routes/api.php'));
} }
} }