Files
panel/app/Repositories/Daemon/DaemonConfigurationRepository.php

35 lines
999 B
PHP
Raw Normal View History

<?php
2024-03-12 22:39:16 -04:00
namespace App\Repositories\Daemon;
2024-03-12 22:39:16 -04:00
use App\Models\Node;
use Illuminate\Http\Client\ConnectionException;
2024-10-19 21:00:11 -04:00
use Illuminate\Http\Client\Response;
class DaemonConfigurationRepository extends DaemonRepository
{
/**
2024-03-12 22:39:16 -04:00
* Returns system information from the daemon instance.
*
* @throws ConnectionException
*/
public function getSystemInformation(): array
{
return $this->getHttpClient()
->connectTimeout(3)
->get('/api/system')->throw()->json();
}
/**
* Updates the configuration information for a daemon. Updates the information for
* this instance using a passed-in model. This allows us to change plenty of information
* in the model, and still use the old, pre-update model to actually make the HTTP request.
*
* @throws ConnectionException
*/
2024-10-19 21:00:11 -04:00
public function update(Node $node): Response
{
return $this->getHttpClient()->post('/api/update', $node->getConfiguration());
}
}