code-8
code-8

Reputation: 58642

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] 
└──

Upvotes: 3

Views: 3070

Answers (2)

Abhay Maurya
Abhay Maurya

Reputation: 12277

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

Upvotes: 4

Ghiffari Assamar
Ghiffari Assamar

Reputation: 661

check your routes (web.php) , find CommentController

it should be there, remove it

the issue is you're calling CommentController under web.php , yet you have no CommentController on your Controller Folder

Upvotes: -1

Related Questions