2023-10-09 09:00:18 +00:00
|
|
|
<?php
|
|
|
|
|
|
2023-12-07 18:06:32 +00:00
|
|
|
namespace App\Livewire\Server;
|
2023-10-09 09:00:18 +00:00
|
|
|
|
2025-10-09 10:53:57 +00:00
|
|
|
use App\Models\CloudProviderToken;
|
2023-10-09 09:00:18 +00:00
|
|
|
use App\Models\PrivateKey;
|
2024-02-23 14:45:53 +00:00
|
|
|
use App\Models\Team;
|
2023-10-09 09:00:18 +00:00
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
|
|
class Create extends Component
|
|
|
|
|
{
|
|
|
|
|
public $private_keys = [];
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2023-10-09 09:00:18 +00:00
|
|
|
public bool $limit_reached = false;
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2025-10-09 10:53:57 +00:00
|
|
|
public bool $has_hetzner_tokens = false;
|
|
|
|
|
|
2023-10-09 09:00:18 +00:00
|
|
|
public function mount()
|
|
|
|
|
{
|
2025-12-08 12:39:33 +00:00
|
|
|
$this->private_keys = PrivateKey::ownedByCurrentTeamCached();
|
2024-06-10 20:43:34 +00:00
|
|
|
if (! isCloud()) {
|
2023-10-09 09:00:18 +00:00
|
|
|
$this->limit_reached = false;
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2023-10-09 09:00:18 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2024-02-23 14:45:53 +00:00
|
|
|
$this->limit_reached = Team::serverLimitReached();
|
2025-10-09 10:53:57 +00:00
|
|
|
|
|
|
|
|
// Check if user has Hetzner tokens
|
|
|
|
|
$this->has_hetzner_tokens = CloudProviderToken::ownedByCurrentTeam()
|
|
|
|
|
->where('provider', 'hetzner')
|
|
|
|
|
->exists();
|
2023-10-09 09:00:18 +00:00
|
|
|
}
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2023-10-09 09:00:18 +00:00
|
|
|
public function render()
|
|
|
|
|
{
|
|
|
|
|
return view('livewire.server.create');
|
|
|
|
|
}
|
|
|
|
|
}
|