mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-07 08:52:35 +00:00
2.x - php
This commit is contained in:
36
app/Web/Pages/Servers/Widgets/ServerStats.php
Normal file
36
app/Web/Pages/Servers/Widgets/ServerStats.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Web\Pages\Servers\Widgets;
|
||||
|
||||
use App\Models\Server;
|
||||
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
|
||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||
|
||||
class ServerStats extends BaseWidget
|
||||
{
|
||||
public Server $server;
|
||||
|
||||
protected static bool $isLazy = false;
|
||||
|
||||
protected function getStats(): array
|
||||
{
|
||||
$stats = [];
|
||||
|
||||
if ($this->server->webserver()) {
|
||||
$stats[] = Stat::make('Sites', $this->server->sites()->count())
|
||||
->icon('heroicon-o-globe-alt');
|
||||
}
|
||||
|
||||
if ($this->server->database()) {
|
||||
$stats[] = Stat::make('Databases', $this->server->databases()->count())
|
||||
->icon('heroicon-o-circle-stack');
|
||||
}
|
||||
|
||||
if ($this->server->defaultService('php')) {
|
||||
$stats[] = Stat::make('PHP Version', $this->server->defaultService('php')->version)
|
||||
->icon('heroicon-o-command-line');
|
||||
}
|
||||
|
||||
return $stats;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user