Add more airlines and fix edit bugs
This commit is contained in:
@@ -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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user