Updated scheduled tasks

This commit is contained in:
2026-07-03 12:24:50 +10:00
parent 598c10c926
commit f422a6e38e
2 changed files with 4 additions and 3 deletions
@@ -11,8 +11,9 @@ use Illuminate\Support\Facades\Gate;
class UserApiController extends ApiController
{
public function nextFlight(User $user): JsonResponse
public function nextFlight(?User $user): JsonResponse
{
$user = $user ?? auth()->user();
if (!$user->id) {
return response()->json(['message' => 'User not found'], 404);
@@ -49,7 +50,7 @@ class UserApiController extends ApiController
'flightNumber' => $flight->flight_number,
'airlineName' => $flight->airline->name,
'aircraftType' => $flight->aircraft->manufacturer_code . ' ' . $flight->aircraft->model_full_name,
'logoUrl' => $flight->airline?->logo_url ?? 'undefined',
'logoUrl' => $flight->airline?->logo_url ?? '',
]);
}
+1 -1
View File
@@ -44,7 +44,7 @@ Route::domain(config('app.api_domain'))->group(function () {
});
Route::prefix('user')->controller(UserApiController::class)->group(function () {
Route::get('{user}/flights/next', 'nextFlight')->name('api.user.flights.next');
Route::get('/flights/next', 'nextFlight')->name('api.user.flights.next');
});
});