2017-12-13 10:14:01 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Faker\Generator as Faker;
|
2018-01-31 02:34:35 +08:00
|
|
|
use App\Models\Enums\UserState;
|
2017-12-13 10:14:01 +08:00
|
|
|
|
2017-12-13 11:50:55 +08:00
|
|
|
$factory->define(App\Models\User::class, function (Faker $faker)
|
|
|
|
{
|
2017-12-13 10:14:01 +08:00
|
|
|
static $password;
|
|
|
|
|
|
|
|
return [
|
2018-02-07 03:11:42 +08:00
|
|
|
'id' => null,
|
2017-12-13 10:14:01 +08:00
|
|
|
'name' => $faker->name,
|
|
|
|
'email' => $faker->safeEmail,
|
2017-12-13 11:50:55 +08:00
|
|
|
'password' => $password ?: $password = Hash::make('secret'),
|
2017-12-13 10:14:01 +08:00
|
|
|
'api_key' => $faker->sha1,
|
2017-12-23 02:46:46 +08:00
|
|
|
'airline_id' => function () {
|
|
|
|
return factory(App\Models\Airline::class)->create()->id;
|
|
|
|
},
|
2017-12-14 00:56:26 +08:00
|
|
|
'rank_id' => 1,
|
2017-12-13 10:14:01 +08:00
|
|
|
'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,
|
2017-12-13 11:50:55 +08:00
|
|
|
'remember_token' => $faker->unique()->text(5),
|
2017-12-13 10:14:01 +08:00
|
|
|
];
|
|
|
|
});
|