tweak route provider default settings

This commit is contained in:
Taylor Otwell 2020-06-24 12:47:56 -05:00
parent e0c4fd8b8a
commit 58a98efb86
1 changed files with 2 additions and 37 deletions

View File

@ -7,18 +7,11 @@
class RouteServiceProvider extends ServiceProvider class RouteServiceProvider extends ServiceProvider
{ {
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/** /**
* The path to the "home" route for your application. * The path to the "home" route for your application.
* *
* Used by Laravel's authentication services to properly redirect users.
*
* @var string * @var string
*/ */
public const HOME = '/home'; public const HOME = '/home';
@ -39,40 +32,12 @@ public function boot()
* @return void * @return void
*/ */
public function map() public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
//
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{ {
Route::middleware('web') Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php')); ->group(base_path('routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api') Route::prefix('api')
->middleware('api') ->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php')); ->group(base_path('routes/api.php'));
} }
} }