2017-12-13 10:14:01 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Faker\Generator as Faker;
|
|
|
|
|
|
|
|
# Match the list available in tests/data/*.yml
|
|
|
|
|
|
|
|
$airlinesAvailable = [1];
|
|
|
|
|
2017-12-13 11:50:55 +08:00
|
|
|
$factory->define(App\Models\Flight::class, function (Faker $faker) use ($airlinesAvailable) {
|
2017-12-13 10:14:01 +08:00
|
|
|
return [
|
2018-02-07 03:11:42 +08:00
|
|
|
'id' => null,
|
|
|
|
'airline_id' => function () {
|
|
|
|
return factory(App\Models\Airline::class)->create()->id;
|
|
|
|
},
|
2018-01-07 05:21:21 +08:00
|
|
|
'flight_number' => $faker->unique()->numberBetween(10, 1000000),
|
2017-12-13 11:50:55 +08:00
|
|
|
'route_code' => $faker->randomElement(['', $faker->text(5)]),
|
|
|
|
'route_leg' => $faker->randomElement(['', $faker->text(5)]),
|
|
|
|
'dpt_airport_id' => function() {
|
|
|
|
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;
|
|
|
|
},
|
2018-02-11 11:16:32 +08:00
|
|
|
'distance' => $faker->numberBetween(0, 3000),
|
2017-12-13 11:50:55 +08:00
|
|
|
'route' => $faker->randomElement(['', $faker->text(5)]),
|
2017-12-13 10:14:01 +08:00
|
|
|
'dpt_time' => $faker->time(),
|
|
|
|
'arr_time' => $faker->time(),
|
2018-02-12 10:38:56 +08:00
|
|
|
'flight_time' => $faker->numberBetween(60, 360),
|
2017-12-13 10:14:01 +08:00
|
|
|
'has_bid' => false,
|
|
|
|
'active' => true,
|
|
|
|
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
|
2018-02-07 03:13:00 +08:00
|
|
|
'updated_at' => function (array $flight) {
|
|
|
|
return $flight['created_at'];
|
2017-12-13 11:50:55 +08:00
|
|
|
},
|
2017-12-13 10:14:01 +08:00
|
|
|
];
|
|
|
|
});
|