2017-12-13 10:14:01 +08:00
|
|
|
<?php
|
|
|
|
|
2020-09-04 00:50:42 +08:00
|
|
|
use App\Models\Airline;
|
2018-01-31 02:34:35 +08:00
|
|
|
use App\Models\Enums\UserState;
|
2018-03-06 12:49:42 +08:00
|
|
|
use Faker\Generator as Faker;
|
2020-09-04 00:50:42 +08:00
|
|
|
use Illuminate\Support\Facades\Hash;
|
2017-12-13 10:14:01 +08:00
|
|
|
|
2018-03-20 09:50:40 +08:00
|
|
|
$factory->define(App\Models\User::class, function (Faker $faker) {
|
2017-12-13 10:14:01 +08:00
|
|
|
static $password;
|
|
|
|
|
|
|
|
return [
|
2018-08-27 00:40:04 +08:00
|
|
|
'id' => null,
|
2020-02-24 06:21:26 +08:00
|
|
|
'pilot_id' => null,
|
2018-08-27 00:40:04 +08:00
|
|
|
'name' => $faker->name,
|
|
|
|
'email' => $faker->safeEmail,
|
|
|
|
'password' => $password ?: $password = Hash::make('secret'),
|
|
|
|
'api_key' => $faker->sha1,
|
|
|
|
'airline_id' => function () {
|
2020-09-04 00:50:42 +08:00
|
|
|
return factory(Airline::class)->create()->id;
|
2017-12-23 02:46:46 +08:00
|
|
|
},
|
2018-03-20 09:50:40 +08:00
|
|
|
'rank_id' => 1,
|
|
|
|
'flights' => $faker->numberBetween(0, 1000),
|
|
|
|
'flight_time' => $faker->numberBetween(0, 10000),
|
|
|
|
'transfer_time' => $faker->numberBetween(0, 10000),
|
|
|
|
'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
|
|
|
];
|
|
|
|
});
|