Updated scheduled tasks
This commit is contained in:
@@ -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
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user