Browse Source

Use fluent routes

Joseph Silber 8 years ago
parent
commit
ef1ef753ba
1 changed files with 11 additions and 13 deletions
  1. 11 13
      app/Providers/RouteServiceProvider.php

+ 11 - 13
app/Providers/RouteServiceProvider.php

@@ -51,12 +51,11 @@ class RouteServiceProvider extends ServiceProvider
      */
     protected function mapWebRoutes()
     {
-        Route::group([
-            'middleware' => 'web',
-            'namespace' => $this->namespace,
-        ], function ($router) {
-            require base_path('routes/web.php');
-        });
+        Route::middleware('web')
+             ->namespace($this->namespace)
+             ->group(function ($router) {
+                 require base_path('routes/web.php');
+             });
     }
 
     /**
@@ -68,12 +67,11 @@ class RouteServiceProvider extends ServiceProvider
      */
     protected function mapApiRoutes()
     {
-        Route::group([
-            'middleware' => 'api',
-            'namespace' => $this->namespace,
-            'prefix' => 'api',
-        ], function ($router) {
-            require base_path('routes/api.php');
-        });
+        Route::prefix('api')
+             ->middleware('api')
+             ->namespace($this->namespace)
+             ->group(function ($router) {
+                 require base_path('routes/api.php');
+             });
     }
 }