Answer the question
In order to leave comments, you need to log in
How to solve the problem with “Target class does not exist” in Laravel?
Faced such a problem. Created a controller through the console using artisan, everything was created successfully. However, when I bind this controller to the route, the Target class [PageController] does not exist error occurs .
web.php:
Route::get('/', [PageController::class, 'home'])->name('home');
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PageController extends Controller {
public function home() {
return view('home');
}
}
Answer the question
In order to leave comments, you need to log in
Route::get('/', [\App\Http\Controllers\PageController::class, 'home'])->name('home');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question