title: How to call an Api Controller from API route in laravel?
body: <p>I have installed jwt authentication &amp; I have created a controller i.e., AuthController Inside Api Directory. I have defined the in routes/api.php as:</p>
  
  <pre><code>Route::group(['prefix'=&gt;'v1', 'namespace' =&gt; 'Api'],function($app){
      Route::get('/test', function(){
          return "HEllo";
      });
      Route::get('test',              'AuthController@test');
  });
  </code></pre>
  
  <p>When I hit the url as: <a href="http://localhost:8000/api/v1/test" rel="nofollow noreferrer">http://localhost:8000/api/v1/test</a> then I am getting error as Class Cotrollers\Api\AuthController does not exist.</p>
  
  <p>AuthController </p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use App\Http\Controllers\Controller;
  
  class AuthController extends Controller
  {
  
  
      public function test() {
          return "Hello";
      }
  }
  </code></pre>
  
  <p>RouteServiceProvider.php:</p>
  
  <pre><code>Route::prefix('api')
      // -&gt;middleware('api')
      // -&gt;namespace($this-&gt;namespace) -&gt;group(base_path('routes/api.php'));
  </code></pre>