Laravel 8 - Target class [PostController] does not exist - Solved

Admin   Laravel   252  2021-03-15 10:10:06

I would like to share with you simple solution of "target class does not exist laravel 8" and "laravel 8 Target class [Controller] does not exist".

Just few days ago launch laravel 8 and i was trying to create my first application with laravel 8 and when i create controller call PostController and when i used with route then i found following issue:

"Target class [PostController] does not exist"

you can see above image too.

Actually this is not an error but laravel 8 removed default namespace form RouteServiceProvider.php file. but i will say this good feature if you want to call your controller class from different namespace.

but now if you want to looking for solution then i will give you two solution. you can use in route file or you can define default namespace on RouteServiceProvider.php file. let's see both solution one by one.

Solution 1: Use on Route File