lasthourcloud/app/Http/Livewire/Dashboard.php

42 lines
1.2 KiB
PHP
Raw Normal View History

2023-08-29 12:36:17 +00:00
<?php
namespace App\Http\Livewire;
use App\Models\Project;
use App\Models\S3Storage;
use App\Models\Server;
use Livewire\Component;
class Dashboard extends Component
{
2023-10-10 08:56:11 +00:00
public $projects = [];
public $servers = [];
2023-08-29 12:36:17 +00:00
public int $s3s = 0;
public int $resources = 0;
public function mount()
{
2023-10-10 08:56:11 +00:00
$this->servers = Server::ownedByCurrentTeam()->get();
2023-08-29 12:36:17 +00:00
$this->s3s = S3Storage::ownedByCurrentTeam()->get()->count();
$projects = Project::ownedByCurrentTeam()->get();
foreach ($projects as $project) {
$this->resources += $project->applications->count();
$this->resources += $project->postgresqls->count();
}
2023-10-10 08:56:11 +00:00
$this->projects = $projects;
2023-08-29 12:36:17 +00:00
}
// public function getIptables()
// {
// $servers = Server::ownedByCurrentTeam()->get();
// foreach ($servers as $server) {
// checkRequiredCommands($server);
// $iptables = instant_remote_process(['docker run --privileged --net=host --pid=host --ipc=host --volume /:/host busybox chroot /host bash -c "iptables -L -n | jc --iptables"'], $server);
// ray($iptables);
// }
// }
2023-08-29 12:36:17 +00:00
public function render()
{
return view('livewire.dashboard');
}
}