Target class [HomeController] does not exist.
i’m using laravel in web.php i have this code :
Route::get('/home','HomeController@home' )->name('home');
Route::get('/about','HomeController@about' )->name('about');
in file homeController.php :
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
//
public function home(){
return view('home');
}
}
>Solution :
What version of Laravel are you using? If you are using Laravel 10 (the latest), you should import the controller and use it like this:
use App\Http\Controllers\UserController;
Route::get('/user/{id}', [UserController::class, 'show']);
You can read more in details in the official documentation here: https://laravel.com/docs/10.x/controllers#basic-controllers