Laravel 11 Target class does not exist.
Hi guys I just wanna ask what are the solution I can try to fix this error?
When Im clicing on my log out href on my dashboard, it also direct me to the url of
localhost:8000/establishment/logout instead of
localhost:8000/establishment/login and give me the error of Target class [establishment] does not exist.
All my middleware, controller, route, auth.php are correct I tried GPT still cant solved the problem.
Tech Laravel 11 Breeze, React
Important Codes Snippet below
Dashboard.jsx
web.php
Establishment.php
EstablishmentMiddleware
11 Replies
whats the namespace of that ::class you used there?
and did you
use
the class in your web.php file?Yes I imported it. I also used the other syntax of importing it on route which is
App\Http\Controllers\EstablishmentController::class,
use App\Http\Controllers\EstablishmentController;
same problem.
Tho removing the middleware fix the problem, but being auth is what I want.
the middleware
Its working now. Thank god.
I dont know what happen but my admin route have a same syntax and I did not even import the AdmidMIddleware, but hey at least my admin is working hahaha
i honestly cant say exactly whats wrong, but the important is that it works
Laravel in a nutshell
🤣 that was how i felt with lumen