2017-12-13 10:14:01 +08:00
|
|
|
<?php
|
2018-04-13 05:12:32 +08:00
|
|
|
/**
|
|
|
|
* Create flights
|
|
|
|
*/
|
2017-12-13 10:14:01 +08:00
|
|
|
use Faker\Generator as Faker;
|
|
|
|
|
2018-04-13 05:12:32 +08:00
|
|
|
$factory->define(App\Models\Flight::class, function (Faker $faker) {
|
2017-12-13 10:14:01 +08:00
|
|
|
return [
|
2018-08-27 00:40:04 +08:00
|
|
|
'id' => $faker->unique()->numberBetween(10, 10000000),
|
|
|
|
'airline_id' => function () {
|
2018-02-07 03:11:42 +08:00
|
|
|
return factory(App\Models\Airline::class)->create()->id;
|
|
|
|
},
|
2018-03-20 09:50:40 +08:00
|
|
|
'flight_number' => $faker->unique()->numberBetween(10, 1000000),
|
|
|
|
'route_code' => $faker->randomElement(['', $faker->text(5)]),
|
2018-05-18 06:03:30 +08:00
|
|
|
'route_leg' => $faker->randomElement(['', $faker->numberBetween(0, 1000)]),
|
2018-03-20 09:50:40 +08:00
|
|
|
'dpt_airport_id' => function () {
|
2017-12-13 11:50:55 +08:00
|
|
|
return factory(App\Models\Airport::class)->create()->id;
|
|
|
|
},
|
|
|
|
'arr_airport_id' => function () {
|
|
|
|
return factory(App\Models\Airport::class)->create()->id;
|
|
|
|
},
|
|
|
|
'alt_airport_id' => function () {
|
|
|
|
return factory(App\Models\Airport::class)->create()->id;
|
|
|
|
},
|
2019-05-11 05:03:04 +08:00
|
|
|
'distance' => $faker->numberBetween(0, 1000),
|
2018-08-27 00:40:04 +08:00
|
|
|
'route' => null,
|
|
|
|
'level' => 0,
|
|
|
|
'dpt_time' => $faker->time(),
|
|
|
|
'arr_time' => $faker->time(),
|
|
|
|
'flight_time' => $faker->numberBetween(60, 360),
|
|
|
|
'has_bid' => false,
|
|
|
|
'active' => true,
|
|
|
|
'visible' => true,
|
|
|
|
'days' => 0,
|
|
|
|
'start_date' => null,
|
|
|
|
'end_date' => null,
|
|
|
|
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
|
2019-05-12 00:37:06 +08:00
|
|
|
'updated_at' => static function (array $flight) {
|
2018-02-07 03:13:00 +08:00
|
|
|
return $flight['created_at'];
|
2017-12-13 11:50:55 +08:00
|
|
|
},
|
2017-12-13 10:14:01 +08:00
|
|
|
];
|
|
|
|
});
|