Files
theme-park-app/app/Http/Services/CaptianCosterApi.php

25 lines
583 B
PHP
Raw Permalink Normal View History

2024-08-21 18:57:36 +02:00
<?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
]);
}
}