Cache the api calls to vacentral and make the iata field optional
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Repositories\AirportRepository;
|
||||
use App\Http\Controllers\AppBaseController;
|
||||
use App\Http\Resources\Airport as AirportResource;
|
||||
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use VaCentral\Airport as AirportLookup;
|
||||
|
||||
class AirportController extends AppBaseController
|
||||
@@ -25,7 +26,14 @@ class AirportController extends AppBaseController
|
||||
*/
|
||||
public function lookup($id)
|
||||
{
|
||||
$airport = AirportLookup::get($id);
|
||||
$airport = Cache::remember(
|
||||
config('cache.keys.AIRPORT_VACENTRAL_LOOKUP.key') . $id,
|
||||
config('cache.keys.RANKS_PILOT_LIST.time'),
|
||||
function () use ($id) {
|
||||
return AirportLookup::get($id);
|
||||
}
|
||||
);
|
||||
|
||||
return new AirportResource(collect($airport));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user