Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cache Error Class does not exist - Laravel 5.7

I can't list my route on Laravel 5.7

I tried php artisan route:list I got

enter image description here

I searched in my entire application, I don't see this file is being imported.

enter image description here

I've also tried

└── composer dumpauto                                                                                  
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: nesbot/carbon
Discovered Package: laravel/slack-notification-channel
Discovered Package: laravel/nexmo-notification-channel
Discovered Package: laravelcollective/remote
Discovered Package: htmlmin/htmlmin
Discovered Package: intervention/image
Discovered Package: laravelcollective/html
Package manifest generated successfully.
You have new mail in /var/mail/root
┌──[root@bheng]──[/home/forge/bheng] 
└── php artisan route:list                                                                                   

In Container.php line 779:

  Class App\Http\Controllers\CommentController does not exist  


┌──[root@bheng]──[/home/forge/bheng] 
└── php artisan cache:clear                                                                             
Application cache cleared!
┌──[root@bheng]──[/home/forge/bheng] 
└── php artisan route:list                                                                                  

In Container.php line 779:

  Class App\Http\Controllers\CommentController does not exist  


┌──[root@bheng]──[/home/forge/bheng] 
└──
like image 486
code-8 Avatar asked Aug 09 '26 20:08

code-8


1 Answers

It happens due to the cache issue in Laravel. You must have had CommentController once, at some point in your project which you have deleted and recreated, now the project doesn't find it even if you have it again. In any case, running folllowing commands should fix your issue:

php artisan view:clear
php artisan route:clear
php artisan cache:clear
php artisan config:clear
composer dump-autoload

See for explanation: https://www.youtube.com/watch?v=Q1ynDMC8UGg

like image 154
Abhay Maurya Avatar answered Aug 12 '26 10:08

Abhay Maurya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!