I have LoginController_old.php and LoginController.php
When I go into the 127.0.0.1/login
I find it runs to the LoginContrller_old.php
not obey the web.php route
Auth::routes();
I use php artisan route:list I see the route is right
Route::get('login', 'App\Http\Controllers\Auth\LoginController@showLoginForm');
Route::post('login', 'App\Http\Controllers\Auth\LoginController@login');
Route::get('logout', 'App\Http\Controllers\Auth\LoginController@logout');
But why it always go to the wrong route...
I trid change the name to old_Logincontroller.php then shows the error message...
"include(/var/www/html/comefo/vendor/composer/../../app/Http/Controllers/Auth/LoginController_old.php): failed to open stream: No such file or directory"
I search the vendor/composer/autoload_static.php I find the error
public static $classMap = array (
'App\\Console\\Kernel' => __DIR__ . '/../..' . '/app/Console/Kernel.php',
'App\\Events\\News' => __DIR__ . '/../..' . '/app/Events/News.php',
'App\\Events\\Queue_number' => __DIR__ . '/../..' . '/app/Events/Queue_number.php',
'App\\Exceptions\\Handler' => __DIR__ . '/../..' . '/app/Exceptions/Handler.php',
'App\\Http\\Controllers\\Auth\\ForgotPasswordController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/ForgotPasswordController.php',
'App\\Http\\Controllers\\Auth\\LoginController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/LoginController old.php',
How come the question? why has the autoload_static.php to mix the route? And how I fix this and never use the autoload_static.php because it waste my whole day.....
fix1 use php artisan route:cache I got the error
LogicException : Unable to prepare route [api/user] for serialization. Uses Closure.
at /var/www/html/comefo/vendor/laravel/framework/src/Illuminate/Routing/Route.php:880
876| */
877| public function prepareForSerialization()
878| {
879| if ($this->action['uses'] instanceof Closure) {
> 880| throw new LogicException("Unable to prepare route [{$this->uri}] for serialization. Uses Closure.");
881| }
882|
883| $this->compileRoute();
884|
Exception trace:
1 Illuminate\Routing\Route::prepareForSerialization()
/var/www/html/comefo/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php:62
2 Illuminate\Foundation\Console\RouteCacheCommand::handle()
/var/www/html/comefo/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29
Please use the argument -v to see more details.