我有模型User并且需要使用faker lib创建db seeder,但是我使用JWT记录了_token。现在如何使用JWT创建_token?
$factory->define(App\User::class, function (Faker\Generator $faker) {
static $password;
return [
'firstName' => $faker->name,
'lastName' => $faker->name,
'username' => $faker->unique()->username,
'email' => $faker->unique()->safeEmail,
'password' => md5('user123'),
'bio' => $faker->sentence(3, true),
'type' => $faker->randomElement(['seller', 'buyer']),
'birthday' => $faker->dateTimeThisCentury,
'avatar' => $faker->imageUrl($width = 400, $height = 400),
'cover' => $faker->imageUrl($width = 851, $height = 315),
'gender' => $faker->randomElement(['male', 'female']),
'country' => $faker->country,
'_token' => JWTAuth::fromUser() // ???,
];
});
答案 0 :(得分:1)
您正在寻找的内容可能是基于令牌的简单身份验证,在这种情况下不是JWT。