24 lines
394 B
PHP
24 lines
394 B
PHP
|
<?php
|
||
|
|
||
|
namespace Silva\Adrema\Support;
|
||
|
|
||
|
use Silva\Adrema\Models\Settings;
|
||
|
use Http;
|
||
|
|
||
|
class Proxy
|
||
|
{
|
||
|
public function run(string $url): ?array
|
||
|
{
|
||
|
$url = str($url)->start('/');
|
||
|
|
||
|
$baseUrl = Settings::get('base_url');
|
||
|
$response = Http::get($baseUrl . $url);
|
||
|
|
||
|
if (!$response->ok()) {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
return $response->json();
|
||
|
}
|
||
|
}
|