25 lines
583 B
PHP
25 lines
583 B
PHP
<?php
|
|
|
|
namespace App\Http\Services;
|
|
|
|
use Illuminate\Http\Client\PendingRequest;
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
class CaptianCosterApi
|
|
{
|
|
private readonly string $uri;
|
|
private readonly PendingRequest $client;
|
|
|
|
function __construct()
|
|
{
|
|
if(!($apiKey = env('CAPTAIN_COASTER_API_KEY'))) {
|
|
throw new \Exception('No API key found for Captain Coaster API');
|
|
}
|
|
|
|
$this->uri = 'https://captaincoaster.com/api/';
|
|
$this->client = Http::baseUrl($this->uri)->withHeaders([
|
|
'Authorization' => $apiKey
|
|
]);
|
|
}
|
|
}
|