title: Struggling with route group namespace definition in Laravel 8
body: <p>I'm trying to use route group in Laravel 8 to define the namespace of my different routes. My goal is to avoid to have a lot of use statement at the begining of the file and to avoid to specify the whole namespace in each route declaration. I will have different namespace for my controllers so it will be handy for me to have the ability to define the namespace of my different route groups.</p>
  <p>It work perfectly fine when I'm using route resource or an invokable controller but as soon as I try to create a custom route on a specific method of a controller I get an error.</p>
  <p>Here is the route definition I tried so far:</p>
  <pre><code>// Example #1: This is working
  Route::middleware('guest')-&gt;namespace('App\Http\Controllers')-&gt;group(function () {
      Route::resource('test', TestController::class)-&gt;only(['index']);
      Route::get('/dashboard', DashboardController::class)-&gt;name('dashboard'); // Invokable controller
  });
  
  // Example #2: This is working
  Route::group(['middleware' =&gt; 'guest', 'namespace' =&gt; 'App\Http\Controllers'], function () {
      Route::resource('test', TestController::class);
      Route::get('/dashboard', DashboardController::class)-&gt;name('dashboard'); // Invokable controller
  });
  
  // Example #3: This is working
  Route::group(['middleware' =&gt; 'guest'], function () {
      Route::get('test', [App\Http\Controllers\TestController::class, 'index']);
  });
  
  // Example #4: This is working
  use App\Http\Controllers\TestController;
  Route::group(['middleware' =&gt; 'guest', 'namespace' =&gt; 'App\Http\Controllers'], function () {
      Route::get('test', [TestController::class, 'index']);
  });
  
  // Example #5: This is working (namespace method is ignored!)
  Route::middleware('guest')-&gt;namespace('App\Http\Controllers')-&gt;group(function () {
      Route::get('test', [App\Http\Controllers\TestController::class, 'index']);
  });
  
  // Example #6:  This is NOT working 
  // Illuminate\Contracts\Container\BindingResolutionException
  // Target class [TestController] does not exist.
  Route::middleware('guest')-&gt;namespace('App\Http\Controllers')-&gt;group(function () {
      Route::get('test', [TestController::class, 'index']);
  });
  </code></pre>
  <p>I think Example #5 should NOT work and Example #6 should work.
  I don't understand what did I miss here?</p>
  <p>Is there a bug somewhere or am I trying to do something totally wrong?</p>
  <p>Thanks for your help!</p>