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