title: Laravel multiple routes file for api
body: <p>I am working on a API for 2 client application, mobile application and angular2 admin panel.</p>
  
  <p>If I write the routes for both application in a single default <code>routes/api.php</code>, this will be very huge.</p>
  
  <p>So, I want to split the api routes file as :</p>
  
  <ol>
  <li><p><code>routes/admin.api.php</code> for angular app</p></li>
  <li><p><code>routes/app.api.php</code> for mobile app</p></li>
  </ol>
  
  <p>I have modified the <code>RouteServiceProvide</code> as below</p>
  
  <pre><code>&lt;?php
  
  namespace App\Providers;
  
  use Illuminate\Support\Facades\Route;
  use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
  
  class RouteServiceProvider extends ServiceProvider
  {
      protected $namespace = 'App\Http\Controllers';
  
      public function boot()
      {
          //
  
          parent::boot();
      }
  
      public function map()
      {
          $this-&gt;mapAdminApiRoutes();
  
          $this-&gt;mapApiRoutes();
  
          $this-&gt;mapWebRoutes();
  
          //
      }
  
      protected function mapWebRoutes()
      {
          Route::middleware('web')
               -&gt;namespace($this-&gt;namespace)
               -&gt;group(base_path('routes/web.php'));
      }
  
      protected function mapApiRoutes()
      {
          Route::prefix('api/v1')
               -&gt;middleware('api')
               -&gt;namespace($this-&gt;namespace)
               -&gt;group(base_path('routes/api.php'));
      }
  
      protected function mapAdminApiRoutes()
      {
          Route::prefix('api/v1')
               -&gt;middleware('api')
               -&gt;namespace($this-&gt;namespace)
               -&gt;group(base_path('routes/admin.api.php'));
      }
  }
  </code></pre>
  
  <p>I'm getting the following error</p>
  
  <pre><code>(1/1) FatalErrorException
  Illuminate\Routing\Router::loadRoutes(): Failed opening required 'D:\Workspace\Project Izzmart\izzmart\routes/api.php' (include_path='.;C:\php\pear')
  in Router.php (line 329)
  </code></pre>