laravel Auth::routes()自动认证生成文件对应关系

我们使用命令生成AUTH类
路由里面会自动添加一段代码
Auth::routes();
 
那我们去配置文件里面找一下AUTH对应的路径:
我们到这个文件下找到Auth这个类

里面有个 routes 方法, 实例化了一个 Router 类,

Illuminate/Routing/Router.php

找到 Illuminate/Routing/Router.php    

里面有auth方法
 
   
 /**
     * Register the typical authentication routes for an application.
     *
     * @return void
     */
    public function auth()
    {
        // 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')->name('password.request');
        $this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
        $this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
        $this->post('password/reset', 'Auth\ResetPasswordController@reset');
    }

 

 
里面定义了一些路由就是auth生成的
posted @ 2019-09-17 19:26  哈妮s  阅读(1100)  评论(0编辑  收藏  举报