Major refactoring for PIREP statuses and states to accomodate ACARS/route data
This commit is contained in:
@@ -8,7 +8,7 @@ use Faker\Generator as Faker;
|
||||
$factory->define(App\Models\Airport::class, function (Faker $faker) {
|
||||
return [
|
||||
'id' => strtoupper($faker->unique()->text(5)),
|
||||
'icao' => function(array $apt) { return $apt['id']; },
|
||||
'icao' => function(array $apt) { return substr($apt['id'],0, 4); },
|
||||
'iata' => function (array $apt) { return $apt['id']; },
|
||||
'name' => $faker->sentence(3),
|
||||
'country' => $faker->country,
|
||||
|
||||
15
app/Database/factories/NavpointFactory.php
Normal file
15
app/Database/factories/NavpointFactory.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Models\Navpoint::class, function (Faker $faker) {
|
||||
return [
|
||||
'id' => $faker->unique()->numberBetween(10, 100000),
|
||||
'name' => $faker->unique()->text(10),
|
||||
'title' => $faker->unique()->text(25),
|
||||
'airway' => $faker->unique()->text(7),
|
||||
'lat' => $faker->latitude,
|
||||
'lon' => $faker->longitude,
|
||||
'freq' => $faker->randomFloat(2, 100, 1000),
|
||||
];
|
||||
});
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Enums\PirepSource;
|
||||
use App\Models\Enums\PirepState;
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
# Match the list available in tests/data/*.yml
|
||||
@@ -40,8 +42,8 @@ $factory->define(App\Models\Pirep::class, function (Faker $faker) use ($airlines
|
||||
'flight_time' => $faker->randomFloat(2),
|
||||
'route' => $faker->text(200),
|
||||
'notes' => $faker->text(200),
|
||||
'source' => $faker->randomElement([0, 1]), # MANUAL/ACARS
|
||||
'status' => config('enums.pirep_status.PENDING'), //$faker->randomElement([-1, 0, 1]), # REJECTED/PENDING/ACCEPTED
|
||||
'source' => $faker->randomElement([PirepSource::MANUAL, PirepSource::ACARS]),
|
||||
'state' => PirepState::PENDING, //$faker->randomElement([-1, 0, 1]), # REJECTED/PENDING/ACCEPTED
|
||||
'raw_data' => $raw_data ?: $raw_data = json_encode(['key' => 'value']),
|
||||
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
|
||||
'updated_at' => function(array $pirep) {
|
||||
|
||||
Reference in New Issue
Block a user