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
@@ -10,7 +10,7 @@ use Inertia\Inertia;
class FlightProfileController extends Controller
{
public function profileData(string $username, string $view) : array {
public function profileData(string $username, string $view, ?int $selectedFlightId = null) : array {
$user = User::whereRaw(DB::raw('LOWER(name) = ?'), [strtolower($username)])->firstOrFail();
$flights = UserFlight::where('user_id', $user->id)
@@ -33,11 +33,12 @@ class FlightProfileController extends Controller
'canEdit' => auth()->check() && auth()->id() === $user->id,
'flights' => UserFlightResource::collection($flights)->resolve(),
'initialView' => $view,
'selectedFlightId' => $selectedFlightId,
];
}
public function departureBoard(string $username){
$profileData = $this->profileData($username, 'board');
public function departureBoard(string $username, ?UserFlight $flight = null){
$profileData = $this->profileData($username, 'board', $flight?->id);
return Inertia::render('UserProfile', $profileData);
}