title: Laravel 8: Target class [ProductController] does not exist
body: <p>I'm using Laravel-8 to develop my project, and I have a resource controller named <code>ProductController</code> which is placed at <code>Admin</code> directory inside <code>Controllers</code>, just like this image is showing:</p>
  <p><a href="https://i.stack.imgur.com/kb7ld.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kb7ld.png" alt="capture" /></a></p>
  <p>Then at my route file, I coded this:</p>
  <pre><code>Route::resource('products', 'ProductController');
  Route::resource('permissions', 'PermissionController');
  </code></pre>
  <p>But when I want to go to <code>products</code> route, I get this message:</p>
  <blockquote>
  <p>Illuminate\Contracts\Container\BindingResolutionException Target class
  <strong>[App\Http\Controllers\Admin\ProductController] does not exist.</strong></p>
  </blockquote>
  <p>Now you may say in Laravel-8, I have to use <code>Route::get('/', ProductController::class);</code>, but as you can see above, I have also determined a <code>permissions</code> route to <code>PermissionController</code> by the old method and it is working completely fine!</p>
  <p>The namespace of Admin is also specified at <code>RouteServiceProvider</code>:</p>
  <pre><code>Route::middleware(['web' , 'auth' , 'auth.admin'])
                  -&gt;namespace('App\Http\Controllers\Admin')
                  -&gt;prefix('admin')
                  -&gt;group(base_path('routes/web/admin.php'));
  </code></pre>
  <p>Note that I also tried <code>Route::resource('products', ProductController::class);</code> , but still get the same error.</p>
  <p>I guess the issue is coming from another part!</p>
  <p>So if you have any idea about this, please let me know, I would really appreciate any idea or suggestion from you guys...</p>
  <p>Thanks in advance.</p>
  <p><strong>UPDATE #1:</strong></p>
  <p><code>ProductController</code> goes like this:</p>
  <pre><code>namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use App\Http\Controllers\Controller;
  use App\Models\Product;
  </code></pre>