From 7ec26ce9167fae5cabcf8cb120b8a373f73597be Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 14 Jul 2016 09:36:17 -0500 Subject: [PATCH] Tweak location of routes files. --- app/Providers/RouteServiceProvider.php | 20 +++++++++++++++++++- routes/api.php | 19 +++++++++++++++++++ app/Http/routes.php => routes/web.php | 2 +- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 routes/api.php rename app/Http/routes.php => routes/web.php (95%) diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index d1f1447b..fba5d9f1 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -37,6 +37,8 @@ public function map() { $this->mapWebRoutes(); + $this->mapApiRoutes(); + // } @@ -52,7 +54,23 @@ protected function mapWebRoutes() Route::group([ 'namespace' => $this->namespace, 'middleware' => 'web', ], function ($router) { - require app_path('Http/routes.php'); + require base_path('routes/web.php'); + }); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + * + * @return void + */ + protected function mapApiRoutes() + { + Route::group([ + 'namespace' => $this->namespace, 'middleware' => 'api', + ], function ($router) { + require base_path('routes/api.php'); }); } } diff --git a/routes/api.php b/routes/api.php new file mode 100644 index 00000000..9216057a --- /dev/null +++ b/routes/api.php @@ -0,0 +1,19 @@ + 'api', + 'middleware' => 'auth:api' +], function () { + // +}); diff --git a/app/Http/routes.php b/routes/web.php similarity index 95% rename from app/Http/routes.php rename to routes/web.php index 0b913d45..23a88190 100644 --- a/app/Http/routes.php +++ b/routes/web.php @@ -2,7 +2,7 @@ /* |-------------------------------------------------------------------------- -| Application Routes +| Web Routes |-------------------------------------------------------------------------- | | This file is where you may define all of the routes that are handled