skip to Main Content

I got a laravel proyect, but when i run php artisan route:list thows this error:

 ReflectionException

  Class "CuboController" does not exist

  at C:UsersricardevSistemaCubosLSvendorlaravelframeworksrcIlluminateFoundationConsoleRouteListCommand.php:234
    230▕             if ($this->isFrameworkController($route)) {
    231▕                 return false;
    232▕             }
    233▕
  ➜ 234▕             $path = (new ReflectionClass($route->getControllerClass()))
    235▕                                 ->getFileName();
    236▕         } else {
    237▕             return false;
    238▕         }

  1   C:UsersricardevSistemaCubosLSvendorlaravelframeworksrcIlluminateFoundationConsoleRouteListCommand.php:234
      ReflectionClass::__construct()

  2   C:UsersricardevSistemaCubosLSvendorlaravelframeworksrcIlluminateFoundationConsoleRouteListCommand.php:156
      IlluminateFoundationConsoleRouteListCommand::isVendorRoute()

The strange thing is that when i start the server with php artisan serve it works perfectly in my machine, but when i try to acces in the ubuntu server does not let me in, throws a 404 error.

The controller exists, and like i said, in local works perfect, but in the apache server throws a 404 error.

What can it be and how can i fix it?

2

Answers


  1. Chosen as BEST ANSWER

    The problem was that in one route the controller was calling the function with an "@", idk excacly why, but chaging that line with just the name of the function solved the issue.

    Thank you everyone for your answers 😀

    the code changed was:

    Route::put('/cubo/{cubo}', 'CuboController@update')->name('cubo.update');
    

    for

    Route::put('/cubo/{cubo}', 'update')->name('cubo.update');
    

  2. dont forget use this in your route

    use AppHttpControllersCuboController;
    

    if it says 404, try to check php artisan route:list. If it not shown, try php artisan optimize

    Mr. Kenneth has explained a lot for you in comment section.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search