2017-12-13 11:50:55 +08:00
|
|
|
<?php
|
|
|
|
|
2020-09-04 01:29:24 +08:00
|
|
|
use App\Models\Airport;
|
|
|
|
use App\Models\Enums\AircraftState;
|
|
|
|
use App\Models\Enums\AircraftStatus;
|
|
|
|
use App\Models\Subfleet;
|
|
|
|
use App\Support\ICAO;
|
2017-12-13 11:50:55 +08:00
|
|
|
use Faker\Generator as Faker;
|
|
|
|
|
|
|
|
$factory->define(App\Models\Aircraft::class, function (Faker $faker) {
|
|
|
|
return [
|
2018-08-27 00:40:04 +08:00
|
|
|
'id' => null,
|
|
|
|
'subfleet_id' => function () {
|
2020-09-04 01:29:24 +08:00
|
|
|
return factory(Subfleet::class)->create()->id;
|
2017-12-13 11:50:55 +08:00
|
|
|
},
|
2018-08-27 00:40:04 +08:00
|
|
|
'airport_id' => function () {
|
2020-09-04 01:29:24 +08:00
|
|
|
return factory(Airport::class)->create()->id;
|
2017-12-13 11:50:55 +08:00
|
|
|
},
|
2018-03-31 09:21:18 +08:00
|
|
|
'iata' => $faker->unique()->text(5),
|
2018-03-20 09:50:40 +08:00
|
|
|
'icao' => $faker->unique()->text(5),
|
2018-03-31 09:21:18 +08:00
|
|
|
'name' => $faker->text(50),
|
2017-12-13 11:50:55 +08:00
|
|
|
'registration' => $faker->unique()->text(10),
|
2020-09-04 01:29:24 +08:00
|
|
|
'hex_code' => ICAO::createHexCode(),
|
|
|
|
'mtow' => $faker->randomFloat(2, 0, 50000),
|
2018-03-31 09:21:18 +08:00
|
|
|
'zfw' => $faker->randomFloat(2, 0, 50000),
|
2020-09-04 01:29:24 +08:00
|
|
|
'status' => AircraftStatus::ACTIVE,
|
|
|
|
'state' => AircraftState::PARKED,
|
2018-03-20 09:50:40 +08:00
|
|
|
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
|
|
|
|
'updated_at' => function (array $pirep) {
|
2017-12-13 11:50:55 +08:00
|
|
|
return $pirep['created_at'];
|
|
|
|
},
|
|
|
|
];
|
|
|
|
});
|