380 vacentral library (#381)
* Update vaCentral library for new API server format * Formatting * Remove missing/unused import
This commit is contained in:
@@ -5,6 +5,8 @@ namespace App\Providers;
|
||||
use App\Contracts\AirportLookup;
|
||||
use App\Contracts\Metar;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use VaCentral\Contracts\IVaCentral;
|
||||
use VaCentral\VaCentral;
|
||||
|
||||
class BindServiceProviders extends ServiceProvider
|
||||
{
|
||||
@@ -25,5 +27,20 @@ class BindServiceProviders extends ServiceProvider
|
||||
AirportLookup::class,
|
||||
config('phpvms.airport_lookup')
|
||||
);
|
||||
|
||||
$this->app->bind(
|
||||
IVaCentral::class,
|
||||
function ($app) {
|
||||
$client = new VaCentral();
|
||||
$client->setVaCentralUrl(config('vacentral.api_url'));
|
||||
|
||||
// Set API if exists
|
||||
if (filled(config('vacentral.api_key'))) {
|
||||
$client->setApiKey(config('vacentral.api_key'));
|
||||
}
|
||||
|
||||
return $client;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user