Style fixes

pull/1448/head
Nabeel Shahzad 3 years ago
parent e2226b7400
commit ca1cd01f3d

@ -33,8 +33,8 @@ class AircraftFactory extends Factory
{ {
return [ return [
'id' => null, 'id' => null,
'subfleet_id' => fn () => Subfleet::factory()->create()->id, 'subfleet_id' => fn () => Subfleet::factory()->create()->id,
'airport_id' => fn () => Airport::factory()->create()->id, 'airport_id' => fn () => Airport::factory()->create()->id,
'iata' => $this->faker->unique()->text(5), 'iata' => $this->faker->unique()->text(5),
'icao' => $this->faker->unique()->text(5), 'icao' => $this->faker->unique()->text(5),
'name' => $this->faker->text(50), 'name' => $this->faker->text(50),
@ -45,7 +45,7 @@ class AircraftFactory extends Factory
'status' => AircraftStatus::ACTIVE, 'status' => AircraftStatus::ACTIVE,
'state' => AircraftState::PARKED, 'state' => AircraftState::PARKED,
'created_at' => $this->faker->dateTimeBetween('-1 week')->format(DateTime::ATOM), 'created_at' => $this->faker->dateTimeBetween('-1 week')->format(DateTime::ATOM),
'updated_at' => fn (array $pirep) => $pirep['created_at'], 'updated_at' => fn (array $pirep) => $pirep['created_at'],
]; ];
} }
} }

@ -32,7 +32,7 @@ class AirlineFactory extends Factory
return $hashids->encode($mt); return $hashids->encode($mt);
}, },
'iata' => fn (array $apt) => $apt['icao'], 'iata' => fn (array $apt) => $apt['icao'],
'name' => $this->faker->sentence(3), 'name' => $this->faker->sentence(3),
'country' => $this->faker->country, 'country' => $this->faker->country,
'active' => 1, 'active' => 1,

@ -55,8 +55,8 @@ class AirportFactory extends Factory
return $airport; return $airport;
}, },
'icao' => fn (array $apt) => $apt['id'], 'icao' => fn (array $apt) => $apt['id'],
'iata' => fn (array $apt) => $apt['id'], 'iata' => fn (array $apt) => $apt['id'],
'name' => $this->faker->sentence(3), 'name' => $this->faker->sentence(3),
'country' => $this->faker->country, 'country' => $this->faker->country,
'timezone' => $this->faker->timezone, 'timezone' => $this->faker->timezone,

@ -28,7 +28,7 @@ class FareFactory extends Factory
'code' => $this->faker->unique()->text(50), 'code' => $this->faker->unique()->text(50),
'name' => $this->faker->text(50), 'name' => $this->faker->text(50),
'price' => $this->faker->randomFloat(2, 100, 1000), 'price' => $this->faker->randomFloat(2, 100, 1000),
'cost' => fn (array $fare) => round($fare['price'] / 2), 'cost' => fn (array $fare) => round($fare['price'] / 2),
'capacity' => $this->faker->randomFloat(0, 20, 500), 'capacity' => $this->faker->randomFloat(0, 20, 500),
]; ];
} }

@ -26,15 +26,15 @@ class FlightFactory extends Factory
{ {
return [ return [
'id' => $this->faker->unique()->numberBetween(10, 10000000), 'id' => $this->faker->unique()->numberBetween(10, 10000000),
'airline_id' => fn () => \App\Models\Airline::factory()->create()->id, 'airline_id' => fn () => \App\Models\Airline::factory()->create()->id,
'flight_number' => $this->faker->unique()->numberBetween(10, 1000000), 'flight_number' => $this->faker->unique()->numberBetween(10, 1000000),
'route_code' => $this->faker->randomElement(['', $this->faker->text(5)]), 'route_code' => $this->faker->randomElement(['', $this->faker->text(5)]),
'route_leg' => $this->faker->randomElement( 'route_leg' => $this->faker->randomElement(
['', $this->faker->numberBetween(0, 1000)] ['', $this->faker->numberBetween(0, 1000)]
), ),
'dpt_airport_id' => static fn () => \App\Models\Airport::factory()->create()->id, 'dpt_airport_id' => static fn () => \App\Models\Airport::factory()->create()->id,
'arr_airport_id' => static fn () => \App\Models\Airport::factory()->create()->id, 'arr_airport_id' => static fn () => \App\Models\Airport::factory()->create()->id,
'alt_airport_id' => static fn () => \App\Models\Airport::factory()->create()->id, 'alt_airport_id' => static fn () => \App\Models\Airport::factory()->create()->id,
'distance' => $this->faker->numberBetween(1, 1000), 'distance' => $this->faker->numberBetween(1, 1000),
'route' => null, 'route' => null,
'level' => 0, 'level' => 0,

@ -28,7 +28,7 @@ class JournalTransactionsFactory extends Factory
{ {
return [ return [
'transaction_group' => Uuid::uuid4()->toString(), 'transaction_group' => Uuid::uuid4()->toString(),
'journal_id' => fn () => Journal::factory()->create()->id, 'journal_id' => fn () => Journal::factory()->create()->id,
'credit' => $this->faker->numberBetween(100, 10000), 'credit' => $this->faker->numberBetween(100, 10000),
'debit' => $this->faker->numberBetween(100, 10000), 'debit' => $this->faker->numberBetween(100, 10000),
'currency' => 'USD', 'currency' => 'USD',

@ -37,15 +37,15 @@ class PirepFactory extends Factory
return [ return [
'id' => $this->faker->unique()->numberBetween(10, 10000000), 'id' => $this->faker->unique()->numberBetween(10, 10000000),
'airline_id' => fn () => $airline->id, 'airline_id' => fn () => $airline->id,
'user_id' => fn () => \App\Models\User::factory()->create()->id, 'user_id' => fn () => \App\Models\User::factory()->create()->id,
'aircraft_id' => fn () => \App\Models\Aircraft::factory()->create()->id, 'aircraft_id' => fn () => \App\Models\Aircraft::factory()->create()->id,
'flight_id' => fn () => $flight->id, 'flight_id' => fn () => $flight->id,
'flight_number' => fn () => $flight->flight_number, 'flight_number' => fn () => $flight->flight_number,
'route_code' => null, 'route_code' => null,
'route_leg' => null, 'route_leg' => null,
'dpt_airport_id' => fn () => $flight->dpt_airport_id, 'dpt_airport_id' => fn () => $flight->dpt_airport_id,
'arr_airport_id' => fn () => $flight->arr_airport_id, 'arr_airport_id' => fn () => $flight->arr_airport_id,
'level' => $this->faker->numberBetween(20, 400), 'level' => $this->faker->numberBetween(20, 400),
'distance' => $this->faker->randomFloat(2, 0, 6000), 'distance' => $this->faker->randomFloat(2, 0, 6000),
'planned_distance' => $this->faker->randomFloat(2, 0, 6000), 'planned_distance' => $this->faker->randomFloat(2, 0, 6000),
@ -53,9 +53,9 @@ class PirepFactory extends Factory
'planned_flight_time' => $this->faker->numberBetween(60, 360), 'planned_flight_time' => $this->faker->numberBetween(60, 360),
'zfw' => $this->faker->randomFloat(2), 'zfw' => $this->faker->randomFloat(2),
'block_fuel' => $this->faker->randomFloat(2, 0, 1000), 'block_fuel' => $this->faker->randomFloat(2, 0, 1000),
'fuel_used' => fn (array $pirep) => round($pirep['block_fuel'] * .9, 2), 'fuel_used' => fn (array $pirep) => round($pirep['block_fuel'] * .9, 2),
'block_on_time' => Carbon::now('UTC'), 'block_on_time' => Carbon::now('UTC'),
'block_off_time' => fn (array $pirep) => $pirep['block_on_time']->subMinutes( 'block_off_time' => fn (array $pirep) => $pirep['block_on_time']->subMinutes(
$pirep['flight_time'] $pirep['flight_time']
), ),
'route' => $this->faker->text(200), 'route' => $this->faker->text(200),
@ -68,7 +68,7 @@ class PirepFactory extends Factory
'status' => PirepStatus::SCHEDULED, 'status' => PirepStatus::SCHEDULED,
'submitted_at' => Carbon::now('UTC')->toDateTimeString(), 'submitted_at' => Carbon::now('UTC')->toDateTimeString(),
'created_at' => Carbon::now('UTC')->toDateTimeString(), 'created_at' => Carbon::now('UTC')->toDateTimeString(),
'updated_at' => fn (array $pirep) => $pirep['created_at'], 'updated_at' => fn (array $pirep) => $pirep['created_at'],
]; ];
} }
} }

@ -25,7 +25,7 @@ class SubfleetFactory extends Factory
{ {
return [ return [
'id' => null, 'id' => null,
'airline_id' => fn () => \App\Models\Airline::factory()->create()->id, 'airline_id' => fn () => \App\Models\Airline::factory()->create()->id,
'name' => $this->faker->unique()->text(50), 'name' => $this->faker->unique()->text(50),
'type' => $this->faker->unique()->text(7), 'type' => $this->faker->unique()->text(7),
'ground_handling_multiplier' => $this->faker->numberBetween(50, 200), 'ground_handling_multiplier' => $this->faker->numberBetween(50, 200),

@ -42,7 +42,7 @@ class UserFactory extends Factory
'email' => $this->faker->safeEmail, 'email' => $this->faker->safeEmail,
'password' => self::$password, 'password' => self::$password,
'api_key' => $this->faker->sha1, 'api_key' => $this->faker->sha1,
'airline_id' => fn () => Airline::factory()->create()->id, 'airline_id' => fn () => Airline::factory()->create()->id,
'rank_id' => 1, 'rank_id' => 1,
'flights' => $this->faker->numberBetween(0, 1000), 'flights' => $this->faker->numberBetween(0, 1000),
'flight_time' => $this->faker->numberBetween(0, 10000), 'flight_time' => $this->faker->numberBetween(0, 10000),

@ -92,7 +92,7 @@ class Airport extends Model
{ {
return Attribute::make( return Attribute::make(
set: fn ($icao) => [ set: fn ($icao) => [
'id' => strtoupper($icao), 'id' => strtoupper($icao),
'icao' => strtoupper($icao), 'icao' => strtoupper($icao),
] ]
); );

Loading…
Cancel
Save