且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Laravel 5用户无法成功验证后进行检索

更新时间:2023-12-03 17:45:28

如何Laravel 5.1使用内置的身份验证

How to use the build-in authentication in Laravel 5.1

Laravel 5.1已建立的认证,它的工作方式几乎开箱即用。

Laravel 5.1 has build in authentication and it works almost out of the box.

有几个步骤要做,所以你将能够使用认证模板漂亮的默认构建在Laravel 5.1。所以,你不需要再创造那个***像Laravel 4.0。

There are few step to do, so you will be able to use the nice default build in Authentication template in Laravel 5.1. So you do not need to invent that wheel again like Laravel 4.0.

1安装Laravel的全新副本(按照此 http://laravel.com/docs/5.1),我做到了,只需使用此命令
作曲家创建项目laravel / laravel - preFER - 距离

1- Install fresh copy of Laravel (follow this http://laravel.com/docs/5.1) I did it by simply using this command composer create-project laravel/laravel --prefer-dist

2 - 创建意见资源\\意见\\ AUTH AUTH 文件夹和文件复制所有资源从它 https://github.com/laravel/laravel/tree/5.0/resources/意见/ AUTH

2- Create auth folder in views resources\views\auth and copy all resources files to it from https://github.com/laravel/laravel/tree/5.0/resources/views/auth

3创建 CSS 字体文件夹里面公共文件夹,并将从资源这两个文件夹的内容 https://github.com/laravel/laravel/树/ 5.0 /公共

3- Create css and fonts folder inside public folder and copy both folders content from resources https://github.com/laravel/laravel/tree/5.0/public

4-更新您的路由文件如下面

4- Update your route file like below

Route::controllers([
    'auth' => 'Auth\AuthController',
    'password' => 'Auth\PasswordController',
]);

关于向 https://github.com/laravel/ laravel / BLOB / 5.0 /应用/ HTTP / routes.php文件

5在你的MySQL创建空数据库。

5- Create empty database in your MySQL.

6更新 .ENV 与数据库信息等文件。

6- Update your .env file with database info etc.

7运行 PHP工匠迁移

8往浏览器和写入的http:// YourLaravelHostProject /认证/注册

9-(可选)如果要更改登录/注册过程后修改 /家居着陆页 AuthController.php 应用程序\\ HTTP \\ \\控制器验证

9- (Optional) If you want to change /home landing page after login/registration process edit AuthController.php in app\Http\Controllers\Auth:

这行之后

use AuthenticatesAndRegistersUsers, ThrottlesLogins;

添加code。与您的位置

Add the code with your location

//forward after login
protected $redirectPath = '/YourLocation'; 

这是它。现在你有默认的登录/注册/重置密码模板的工作。你可以修改它继续使用。

That is it. Now you have the default login/register/reset password template working. You can modify it for further use.

PHP工匠迁移结果
Laravel 5用户无法成功验证后进行检索

登录页面的浏览器的快照
Laravel 5用户无法成功验证后进行检索

另外,也可以通过以下Laravel文档,以较简单的认证模板

It is also possible to make a simpler authentication template by following Laravel documentation.

Laravel身份验证文档 http://laravel.com/docs/5.1/authentication

Laravel authentication documentation http://laravel.com/docs/5.1/authentication