title: Laravel Api Route with namespace failed
body: <p>i have a small crud frontend to store information. The frontend controller is called <code>ShowsController</code>. And i want to get alle Shows from the api.</p>
  
  <p>So my <code>routes/web.php</code> contains:</p>
  
  <pre><code>Route::resource('shows', 'ShowsController');
  </code></pre>
  
  <p>Thats perfect and worked really well.</p>
  
  <p>My <code>routes/api.php</code> contains:</p>
  
  <pre><code>Route::resource('shows', 'ShowsController', ['only' =&gt; ['index']]);
  </code></pre>
  
  <p>The route <code>/api/shows</code> should give me the shows as json.
  to decide frontend and api i put the <code>ShowsController</code> into <code>Controllers/Api folder</code></p>
  
  <p>The <code>Controllers/Api/ShowsController</code> contains:</p>
  
  <pre><code>namespace App\Http\Controllers\Api;
  
  use Illuminate\Http\Request;
  use App\Show;
  
  class ShowsController extends Controller
  {
      public function index(){
          return response()
              -&gt;json(Show::all())-&gt;withHeaders([
                  'Content-Type' =&gt; 'text/json',
                  'Access-Control-Allow-Origin' =&gt; '*'
              ]);
      }
  }
  </code></pre>
  
  <p>And i also changed the <code>RouteServiceProvider</code> to:</p>
  
  <pre><code>protected function mapApiRoutes()
  {
      Route::group([
          'middleware' =&gt; 'api',
          'namespace' =&gt; 'Api',
          'prefix' =&gt; 'api',
      ], function ($router) {
          require base_path('routes/api.php');
      });
  }
  </code></pre>
  
  <p>But the command <code>php artisan route:list</code> gives me an exception:</p>
  
  <blockquote>
    <p>[ReflectionException]<br>
      Class Api\ShowsController does not exist</p>
  </blockquote>
  
  <p>Why is laravel not finding the defined ShowsController in the api directory?  </p>