+1 vote
by
I ran into this problem. I created a controller through the console using artisan, everything worked fine. However, when I bind this controller to a root, I get an error Target class [PageController] does not exist.
HNeoM.png

web.php:
Route::get('/', [PageController::class, 'home'])->name('home');

PageController:
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class PageController extends Controller {

public function home() {
return view('home');
}

}
by
Don't read the documentation for religious or other reasons?

1 Answer

0 votes
by
 
Best answer
Route::get('/', [\App\Http\Controllers\PageController::class, 'home'])->name('home');
...