no message

This commit is contained in:
StudioTem committed 2023-03-24 13:46:29 +01:00
1 parent 04c42c2762
commit d69fcf328b
8 files changed
+286 -2

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
<?php
namespace App\Services\Intranet;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Http;
class Api
{
private static mixed $token;
private static mixed $endpoint;
public function __construct()
{
self::$token = Config::get('services.intranet.token');
self::$endpoint = Config::get('services.intranet.endpoint');
}
private static function doRequest($command, $dateFrom)
{
$response = Http::timeout(60)
->withOptions([
'debug' => true,
'verify' => false,
])->get(self::$endpoint . $command, [
'date-from' => $dateFrom,
'api-token' => self::$token,
]);
return $response->json();
}
public static function getVacations($dateFrom)
{
return self::doRequest('vacations', $dateFrom)['vacations'];
}
}