laravel 8 controller does not exist code example
Example 1: Target class [Controller] does not exist.
//accessing any function in the controller (this is web.php file)
use App\Http\Controllers\PostsController;
Route::get('/post', 'App\Http\Controllers\PostsController@index');
Example 2: laravel target class does not exist
Uncomment this line in app>>provider>>RouteServiceProvider.php file
// protected $namespace = 'App\\Http\\Controllers';
Example 3: Target class [PlayerController] does not exist.
//add controller path
Route::get('/players', 'App\Http\Controllers\PlayerController@index');
Example 4: controller class does not exist laravel
The $namespace property:
Though there is a mention of a $namespace property to be set on your RouteServiceProvider in the Release notes and commented in your RouteServiceProvider this does not have any effect on your routes. It is currently only for adding a namespace prefix for generating URLs to actions. So you can set this variable, but it by itself won't add these namespace prefixes, you would still have to make sure you would be using this variable when adding the namespace to the route groups.