mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 00:34:44 +02:00

* Not found property rule * Make these “better” * Day 1 * Day 2 * Day 3 * Dat 4 * Remove disabled check * Day 4 continued * Run pint * Final changes hopefully * Pint fixes * Fix again * Reset these * Update app/Filament/Admin/Pages/Health.php Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> * Update app/Traits/CheckMigrationsTrait.php Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> --------- Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com>
53 lines
1.1 KiB
PHP
53 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Repositories\Daemon;
|
|
|
|
use App\Models\Node;
|
|
use Illuminate\Http\Client\PendingRequest;
|
|
use Illuminate\Support\Facades\Http;
|
|
use Webmozart\Assert\Assert;
|
|
use App\Models\Server;
|
|
|
|
abstract class DaemonRepository
|
|
{
|
|
protected ?Server $server;
|
|
|
|
protected ?Node $node;
|
|
|
|
/**
|
|
* Set the server model this request is stemming from.
|
|
*
|
|
* @return static
|
|
*/
|
|
public function setServer(Server $server): self
|
|
{
|
|
$this->server = $server;
|
|
|
|
$this->setNode($this->server->node);
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Set the node model this request is stemming from.
|
|
*/
|
|
public function setNode(Node $node): static
|
|
{
|
|
$this->node = $node;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Return an instance of the Guzzle HTTP Client to be used for requests.
|
|
*
|
|
* @param array<string, string> $headers
|
|
*/
|
|
public function getHttpClient(array $headers = []): PendingRequest
|
|
{
|
|
Assert::isInstanceOf($this->node, Node::class);
|
|
|
|
return Http::daemon($this->node, $headers);
|
|
}
|
|
}
|