mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 22:39:34 +00:00
no message
This commit is contained in:
1 parent
04c42c2762
commit
d69fcf328b
8 files changed
+286
-2
No files matched your search
@@ -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'];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user