Updated logo API

This commit is contained in:
2026-04-23 21:32:25 +10:00
parent 110ed5b984
commit 678096b463
22 changed files with 638 additions and 146 deletions
@@ -10,51 +10,35 @@ use Inertia\Inertia;
class FlightProfileController extends Controller
{
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)
->with([
'departureAirport.region.country',
'departureAirport.region.continent',
'arrivalAirport.region.country',
'arrivalAirport.region.continent',
'airline.country',
'aircraft',
'seatType',
'flightReason',
'flightClass',
'crewType'
])
->orderBy('departure_date', 'desc')
->get();
public function profileData(User $user, string $view, ?int $selectedFlightId = null) : array {
$flights = $user->FlightController()->flights();
return [
'user' => $user,
'canEdit' => auth()->check() && auth()->id() === $user->id,
'flights' => UserFlightResource::collection($flights)->resolve(),
'initialView' => $view,
'selectedFlightId' => $selectedFlightId,
'isFollowing' => auth()->check() && auth()->user()->isFollowing($user),
];
}
public function departureBoard(string $username, ?UserFlight $flight = null){
$profileData = $this->profileData($username, 'board', $flight?->id);
public function departureBoard(User $user, ?UserFlight $flight = null){
$profileData = $this->profileData($user, 'board', $flight?->id);
return Inertia::render('UserProfile', $profileData);
}
public function map(string $username){
$profileData = $this->profileData($username, 'map');
public function map(User $user){
$profileData = $this->profileData($user, 'map');
return Inertia::render('UserProfile', $profileData);
}
public function boardingPasses(string $username){
$profileData = $this->profileData($username, 'passes');
public function boardingPasses(User $user){
$profileData = $this->profileData($user, 'passes');
return Inertia::render('UserProfile', $profileData);
}
public function view(string $username)
public function view(User $user)
{
return $this->departureBoard($username);
return $this->departureBoard($user);
}
}