tissue/database/factories/UserFactory.php

24 lines
661 B
PHP
Raw Normal View History

2019-12-11 01:32:55 +09:00
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
2020-05-23 21:34:49 +09:00
use Illuminate\Support\Str;
2019-12-11 01:32:55 +09:00
$factory->define(App\User::class, function (Faker\Generator $faker) {
static $password;
return [
'name' => substr($faker->userName, 0, 15),
'email' => $faker->unique()->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
2020-05-23 21:34:49 +09:00
'remember_token' => Str::random(10),
2019-12-11 01:32:55 +09:00
'display_name' => substr($faker->name, 0, 20),
'is_protected' => false,
'accept_analytics' => false,
'private_likes' => false,
];
});
$factory->state(App\User::class, 'protected', [
'is_protected' => true,
]);