在网站的登录验证逻辑中,为了好维护,一般后台会独立出来一个模块, 此时就不能和前台的模块混到一起去验证, 需要单独为后台指定一个guard(提供数据的)

auth
laravel 的Auth是由两个部分组成的
- guard 负责提供数据给Auth
- Auth 负责验证逻辑
这是我个人理解, 具体还是看官方文档
https://learnku.com/docs/laravel/5.8/authentication/1308#other-authentication-methods
后台登录 指定guard 不用默认的 users 表
准备
生成admin模型 同时 迁移 admin 表
php artisan make:model Admin -m
填充数据
- 修改
database/factories/ModelFactory.php
$factory->define(App\Admin::class, function (Faker\Generator $faker) {
static $password;
return [
'account' => $faker->unique()->safe