Add more airlines and fix edit bugs

This commit is contained in:
2026-04-20 16:42:11 +10:00
parent 061ee9dd07
commit e007824fa9
15 changed files with 458 additions and 276 deletions
+9 -9
View File
@@ -97,9 +97,9 @@ class FlightController extends Controller
{
$validated = $request->validate($this->rules());
auth()->user()->flights()->create($this->flightPayload($validated));
$newFlight = auth()->user()->flights()->create($this->flightPayload($validated));
return redirect()->route('dashboard', Auth::user()->name);
return redirect()->route('profile.departure-board', [Auth::user()->name, $newFlight->id]);
}
public function update(Request $request, UserFlight $flight)
@@ -110,14 +110,14 @@ class FlightController extends Controller
$flight->update($this->flightPayload($validated));
return redirect()->route('dashboard', Auth::user()->name);
return redirect()->route('profile.departure-board', [Auth::user()->name, $flight->id]);
}
public function add(){
return Inertia::render('AddFlight', [
'seat_types' => SeatType::all()->toArray(),
'flight_reasons' => FlightReason::all()->toArray(),
'flight_classes' => FlightClass::all()->toArray(),
'seat_types' => SeatType::orderBy('id')->get()->toArray(),
'flight_reasons' => FlightReason::orderBy('id')->get()->toArray(),
'flight_classes' => FlightClass::orderBy('id')->get()->toArray(),
]);
}
@@ -148,9 +148,9 @@ class FlightController extends Controller
];
return Inertia::render('AddFlight', [
'flight' => $flightData,
'seat_types' => SeatType::all()->toArray(),
'flight_classes' => FlightClass::all()->toArray(),
'flight_reasons' => FlightReason::all()->toArray(),
'seat_types' => SeatType::orderBy('id')->get()->toArray(),
'flight_reasons' => FlightReason::orderBy('id')->get()->toArray(),
'flight_classes' => FlightClass::orderBy('id')->get()->toArray(),
]);
}
}