mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 22:39:34 +00:00
39 lines
992 B
PHP
39 lines
992 B
PHP
<?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'];
|
|
}
|
|
}
|