laravel 5.3 new Auth::routes()

后端 未结 10 1354
清歌不尽
清歌不尽 2020-12-04 05:26

Recently I start to use laravel 5.3 to write a blog, but I have a question after run php artisan make:auth

when I run this, it will generate routes in m

相关标签:
10条回答
  • 2020-12-04 06:13

    if you are in laravel 5.7 and above Auth::routes(['register' => false]); in web.php

    more possible options are as:

    Auth::routes([
      'register' => false, // Routes of Registration
      'reset' => false,    // Routes of Password Reset
      'verify' => false,   // Routes of Email Verification
    ]);
    
    0 讨论(0)
  • 2020-12-04 06:15

    Auth routes for Laravel 5.3 instead Auth::routes(). I hope it helps...

    Route::group(['middleware' => ['web']], function() {
    
    // Login Routes...
        Route::get('login', ['as' => 'login', 'uses' => 'Auth\LoginController@showLoginForm']);
        Route::post('login', ['as' => 'login.post', 'uses' => 'Auth\LoginController@login']);
        Route::post('logout', ['as' => 'logout', 'uses' => 'Auth\LoginController@logout']);
    
    // Registration Routes...
        Route::get('register', ['as' => 'register', 'uses' => 'Auth\RegisterController@showRegistrationForm']);
        Route::post('register', ['as' => 'register.post', 'uses' => 'Auth\RegisterController@register']);
    
    // Password Reset Routes...
        Route::get('password/reset', ['as' => 'password.reset', 'uses' => 'Auth\ForgotPasswordController@showLinkRequestForm']);
        Route::post('password/email', ['as' => 'password.email', 'uses' => 'Auth\ForgotPasswordController@sendResetLinkEmail']);
        Route::get('password/reset/{token}', ['as' => 'password.reset.token', 'uses' => 'Auth\ResetPasswordController@showResetForm']);
        Route::post('password/reset', ['as' => 'password.reset.post', 'uses' => 'Auth\ResetPasswordController@reset']);
    });
    

    So if you change some names of these routes, remember to also change in views the actions of the posts!

    0 讨论(0)
  • 2020-12-04 06:15

    the loginuser class uses a trait called AuthenticatesUsers

    if you open that trait you will see the functions (this applies for other controllers) Illuminate\Foundation\Auth\AuthenticatesUsers;

    here is the trait code https://github.com/laravel/framework/blob/5.1/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php

    sorry for the bad format, im using my phone

    also Auth::routes() it just calls a function that returns the auth routes thats it (i think)

    0 讨论(0)
  • 2020-12-04 06:20

    If you are searching these same routes for laravel 7 version you'll find it here Vendor/laravel/ui/src/AuthRouteMethods.php

    0 讨论(0)
提交回复
热议问题