Search code examples
phplaravellaravel-controller

Laravel - Error ResetPasswordController not found in route list


I have this error while execute the command php artisan route:list :

ReflectionException  : Class App\Http\Controllers\Auth\ResetPasswordController does not exist

at /Applications/MAMP/htdocs/test/vendor/laravel/framework/src/Illuminate/Container/Container.php:790

Where can I check? I use the php artisan make:auth to generate this file.
The file exists under app/Http/Controllers/Auth/ResetPasswordController.php.

This is the content:

    <?php

    namespace App\Http\Controllers\Auth;

    use App\Http\Controllers\Controller;
    use Illuminate\Foundation\Auth\ResetsPasswords;

    class ResetPasswordController extends Controller
    {
        /*
        |--------------------------------------------------------------------------
        | Password Reset Controller
        |--------------------------------------------------------------------------
        |
        | This controller is responsible for handling password reset requests
        | and uses a simple trait to include this behavior. You're free to
        | explore this trait and override any methods you wish to tweak.
        |
        */

        use ResetsPasswords;

        /**
        * Where to redirect users after resetting their password.
        *
        * @var string
        */
        protected $redirectTo = '/home';

        /**
        * Create a new controller instance.
        *
        * @return void
        */
        public function __construct()
        {
            $this->middleware('guest');
        }
    }

Solution

  • The routes are cached and don't get a fresh version of your files/classes

    So you need to add them to the classmap by running

    composer dumpautoload
    

    Hope this helps