phpvms/app/Database/factories/UserFactory.php

27 lines
786 B
PHP
Raw Normal View History

<?php
2018-01-31 02:34:35 +08:00
use App\Models\Enums\UserState;
use Faker\Generator as Faker;
$factory->define(App\Models\User::class, function (Faker $faker)
{
static $password;
return [
'id' => null,
'name' => $faker->name,
'email' => $faker->safeEmail,
'password' => $password ?: $password = Hash::make('secret'),
'api_key' => $faker->sha1,
'airline_id' => function () {
return factory(App\Models\Airline::class)->create()->id;
},
'rank_id' => 1,
'flights' => $faker->numberBetween(0, 1000),
'flight_time' => $faker->numberBetween(0, 10000),
2018-01-31 02:34:35 +08:00
'transfer_time' => $faker->numberBetween(0, 10000),
2018-01-05 11:05:26 +08:00
'state' => UserState::ACTIVE,
'remember_token' => $faker->unique()->text(5),
];
});