Files
ploi-core/app/Filament/Pages/System.php
Dennis 58c91fe7bc wip
2022-08-16 08:15:05 +02:00

50 lines
1.2 KiB
PHP

<?php
namespace App\Filament\Pages;
use Filament\Pages\Page;
use App\Services\VersionChecker;
use Filament\Notifications\Notification;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
class System extends Page
{
protected static ?string $navigationIcon = 'heroicon-o-adjustments';
protected static string $view = 'filament.pages.system';
protected static ?string $navigationGroup = 'Settings';
protected static ?int $navigationSort = 2;
public function getCurrentVersion(): string
{
return app(VersionChecker::class)->getVersions()->currentVersion;
}
public function getRemoteVersion(): string
{
return app(VersionChecker::class)->getVersions()->remoteVersion;
}
public function refreshRemoteVersion(): void
{
app(VersionChecker::class)->flushVersionData();
Notification::make()
->success()
->body(__('Refreshed versions'))
->send();
}
public function getHorizonWorkerStatus(): bool
{
return rescue(fn () => (bool) app(MasterSupervisorRepository::class)->all(), false, false);
}
public function hasAvailableUpdate(): bool
{
return app(VersionChecker::class)->getVersions()->isOutOfDate();
}
}