您的位置:首页 > 其它

用户认证

2016-04-25 20:48 281 查看
创建所需要的路由和视图

命令行执行

php artisan make:auth


会创建出以下的相关文件

Created View: D:\wwwroot\hongjh.info\resources/views/auth/login.blade.php
Created View: D:\wwwroot\hongjh.info\resources/views/auth/register.blade.php
Created View: D:\wwwroot\hongjh.info\resources/views/auth/passwords/email.blade.php
Created View: D:\wwwroot\hongjh.info\resources/views/auth/passwords/reset.blade.php
Created View: D:\wwwroot\hongjh.info\resources/views/auth/emails/password.blade.php
Created View: D:\wwwroot\hongjh.info\resources/views/layouts/app.blade.php
Created View: D:\wwwroot\hongjh.info\resources/views/home.blade.php
Created View: D:\wwwroot\hongjh.info\resources/view/welcome.blade.php


创建相关数据结构

$ php artisan migrate
Migration table created successfully.
Migrated: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_100000_create_password_resets_table


产生了 users , password_resets 两张表

在 app\Http\routes.php文件下,自动添加了

Route::auth();


对应的代码逻辑如下:

namespace Illuminate\Routing;

public function auth()
{
// Authentication Routes...
$this->get('login', 'Auth\AuthController@showLoginForm');
$this->post('login', 'Auth\AuthController@login');
$this->get('logout', 'Auth\AuthController@logout');

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

// Password Reset Routes...
$this->get('password/reset/{token?}', 'Auth\PasswordController@showResetForm');
$this->post('password/email', 'Auth\PasswordController@sendResetLinkEmail');
$this->post('password/reset', 'Auth\PasswordController@reset');
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: