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