2017-12-13 11:50:55 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Faker\Generator as Faker;
|
|
|
|
|
2018-08-27 00:40:04 +08:00
|
|
|
/*
|
2017-12-13 11:50:55 +08:00
|
|
|
* Add any number of airports. Don't really care if they're real or not
|
|
|
|
*/
|
|
|
|
$factory->define(App\Models\Airport::class, function (Faker $faker) {
|
|
|
|
return [
|
2018-05-06 23:26:57 +08:00
|
|
|
'id' => function () {
|
2018-01-06 04:56:07 +08:00
|
|
|
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
|
|
$string = '';
|
|
|
|
$max = strlen($characters) - 1;
|
2018-05-08 04:11:59 +08:00
|
|
|
for ($i = 0; $i < 4; $i++) {
|
2018-01-06 04:56:07 +08:00
|
|
|
$string .= $characters[random_int(0, $max)];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $string;
|
2018-01-06 00:23:26 +08:00
|
|
|
},
|
2018-08-27 00:40:04 +08:00
|
|
|
'icao' => function (array $apt) {
|
2018-03-20 09:50:40 +08:00
|
|
|
return $apt['id'];
|
|
|
|
},
|
2018-08-27 00:40:04 +08:00
|
|
|
'iata' => function (array $apt) {
|
2018-03-20 09:50:40 +08:00
|
|
|
return $apt['id'];
|
|
|
|
},
|
|
|
|
'name' => $faker->sentence(3),
|
|
|
|
'country' => $faker->country,
|
|
|
|
'timezone' => $faker->timezone,
|
|
|
|
'lat' => $faker->latitude,
|
|
|
|
'lon' => $faker->longitude,
|
2018-05-06 23:26:57 +08:00
|
|
|
'hub' => false,
|
2018-02-24 05:48:50 +08:00
|
|
|
'ground_handling_cost' => $faker->randomFloat(2, 0, 500),
|
2018-03-20 09:50:40 +08:00
|
|
|
'fuel_100ll_cost' => $faker->randomFloat(2, 0, 100),
|
|
|
|
'fuel_jeta_cost' => $faker->randomFloat(2, 0, 100),
|
|
|
|
'fuel_mogas_cost' => $faker->randomFloat(2, 0, 100),
|
2017-12-13 11:50:55 +08:00
|
|
|
];
|
|
|
|
});
|