intothesource/entrance

登录和密码重置的入口包

1.0.10 2017-09-22 07:11 UTC

README

完整的入口包,包括登录和密码重置。

安装

composer require intothesource/entrance

安装后

ServiceProvider

将以下行添加到 "config/app.php" 文件中的 "providers" 部分

在 "providers" 部分

IntoTheSource\Entrance\EntranceServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,

并在 "aliases" 部分

'Form'      => Collective\Html\FormFacade::class,
'Html'      => Collective\Html\HtmlFacade::class,

创建文件

运行以下命令:(由于 Laravel 中已存在 User 和 Password reset 表,这里使用 force,将会覆盖它们。)

php artisan vendor:publish --force

迁移

运行命令

php artisan migrate

中间件

将以下行添加到文件 'App/Http/Kernel.php' 中的 '$routeMiddleware' 数组

'checktoken' => \IntoTheSource\Entrance\Http\Middleware\CheckToken::class,
'checklogin' => \IntoTheSource\Entrance\Http\Middleware\CheckLogin::class,

电子邮件

此包会发送电子邮件。请确保配置您的邮件设置。在 -> config/mail.php 中设置全局 FROM 地址。

Exmaple:
 'from' => ['address' => 'laravel@laravel.com', 'name' => 'LaravelDev'],

有关邮件设置的更多信息,请参阅 www.laravel.com/docs/master/mail

使用自定义电子邮件模板发送密码重置邮件。

更改 -> config/entrance.php 中的视图路由

'mail' => [
 			'password_reset' => '<your view here>'
 		]

认证路由

将所有需要用户登录的路由添加到该组中。

Route::group(['middleware' => 'checklogin'], function() {
    <Your routes>
});
插入基本用户(别忘了更改密码)

在 run() 函数中将以下种子放入 database/seeds/DatabaseSeeder.php

$this->call(MainUserSeed::class);

运行

artisan db:seed