diff --git a/app/Http/Controllers/LogoController.php b/app/Http/Controllers/LogoController.php index d15e226..6841205 100644 --- a/app/Http/Controllers/LogoController.php +++ b/app/Http/Controllers/LogoController.php @@ -24,9 +24,17 @@ class LogoController extends Controller public function getLogoByIATACode(string $code) { $airline = Airline::where('IATA_code', strtoupper($code)) - ->whereNotNull('logo') - ->latest('id') - ->first(); + ->whereNotNull('logo') + ->where('active', true) + ->latest('id') + ->first(); + + if (!$airline) { + $airline = Airline::where('IATA_code', strtoupper($code)) + ->whereNotNull('logo') + ->latest('id') + ->first(); + } return $this->getAirlineLogo($airline); } @@ -34,9 +42,17 @@ class LogoController extends Controller public function getLogoByICAOCode(string $code) { $airline = Airline::where('ICAO_code', strtoupper($code)) - ->whereNotNull('logo') - ->latest('id') - ->first(); + ->whereNotNull('logo') + ->where('active', true) + ->latest('id') + ->first(); + + if (!$airline) { + $airline = Airline::where('ICAO_code', strtoupper($code)) + ->whereNotNull('logo') + ->latest('id') + ->first(); + } return $this->getAirlineLogo($airline); }