Added achievement data

This commit is contained in:
2026-04-28 22:16:21 +10:00
parent 14aed7bf6e
commit b94b1d8ec2
43 changed files with 1559 additions and 130 deletions
@@ -9,6 +9,7 @@ use App\Models\FlightClass;
use App\Models\FlightReason;
use App\Models\ImportedFlight;
use App\Models\SeatType;
use App\Models\UserAction;
use App\Models\UserFlight;
use Carbon\Carbon;
use Illuminate\Http\Request;
@@ -128,10 +129,11 @@ class FlightImportController extends Controller
})
->orderByDesc('active')
->limit(10)
->get(['id', 'name', 'IATA_code', 'ICAO_code'])
->get(['id', 'name', 'IATA_code', 'ICAO_code', 'internal_name'])
->map(fn($airline) => [
'value' => $airline->id,
'title' => $airline->display_name,
'logo_url' => $airline->logo_url,
])
->values()
->toArray();
@@ -243,7 +245,7 @@ class FlightImportController extends Controller
$arrival = $durationArrival;
}
UserFlight::create([
$newFlight = UserFlight::create([
'user_id' => $user->id,
'departure_date' => $departure,
'arrival_date' => $arrival,
@@ -260,6 +262,14 @@ class FlightImportController extends Controller
'note' => $validated['note'] ?? null,
]);
UserAction::create([
'user_id' => $newFlight->user_id,
'type' => $newFlight->departure_date->isFuture() ? 'flight_booked' : 'flight_imported',
'data' => [
'flight' => $newFlight->snapshot($newFlight->id),
],
]);
ImportedFlight::destroy($validated['imported_flight_id']);
return to_route('reconcile');
}