the controller is existing, and the method ‘test’ exist on ‘app\http\controllers\admin\indexcontroller’. but laravel show me that there is no method on the controller, i don’t know why. i have askd for help on the internet, but no one can help me. the error like pic1.

 

 now i show you my project folder and the files.

 

 the namespace of the indexcontroller.php is right. and the method test is existed. but laravel told me that method does not exist… i don’t know what happend!

maybe you have the same trouble, now, i will give you a way to solve the problem. then, let’s go.

look at this file.

 

 there is a backup file in my project. i had edited the controller file after created the backup file. so the content of the two files is different. initially, there is no problem. but when i execute the command “composer update”… oh, my god!

now, look at the directory vendor/composer, and open the file autoload_clappmap.php and autoload_static.php. search indexcontroller in the two files.

in autoload_classmap.php:

 

 in autoload_static.php:

 

 look at the red box. the real file is not indexcontroller.php, but is the backup file. i have said, the two file is different. the method test does not on indexcontroller.bk.php. so laravel show me the error.

we have known why the problem happend. now, we should solve it.

1) update the ‘indexcontroller.bk.php’ to ‘indexcontroller.php’ that in the autoload_classmap.php and autoload_static.php.

2) or you can delete the backup file or move it to other directory, then do 1).

3) or you can delete the backup file or move it to other directory. then execute the command composer update. but it is slow…

 

report:

developing good programming habits can avoid many mistakes.