Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kirtangajjar's avatar

Overriding default Auth::routes() in laravel 5.3

So am trying to override Auth::routes, but was unable to do that. I tried commenting that out, but then ALL the methods get removed.

I just want to override GET /login route and point it to a different view.

Does anyoune has any idea on how to do it?

0 likes
3 replies
Snapey's avatar
Snapey
Best Answer
Level 122

replicate all the routes then remove the helper.

Auth::routes is a shortcut for

 {
        // Authentication Routes...
        $this->get('login', 'Auth\LoginController@showLoginForm')->name('login');
        $this->post('login', 'Auth\LoginController@login');
        $this->post('logout', 'Auth\LoginController@logout')->name('logout');

        // Registration Routes...
        $this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
        $this->post('register', 'Auth\RegisterController@register');

        // Password Reset Routes...
        $this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm');
        $this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');
        $this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm');
        $this->post('password/reset', 'Auth\ResetPasswordController@reset');
    }

which you can find in /vendor/laravel/framework/src/Illuminate/Routing/Router.php but don't be tempted to change it there.

Put the above in your web.php file, but replace $this-> for the Route:: facade

11 likes
mrcheeks's avatar
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
1 like

Please or to participate in this conversation.