Fix GSLToken id, label & query (#1361)

This commit is contained in:
MartinOscar 2025-05-09 23:57:18 +02:00 committed by GitHub
parent 1f8a5cdd1d
commit 6de6306a19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,8 +14,11 @@ use Filament\Facades\Filament;
use Filament\Forms\Components\Placeholder; use Filament\Forms\Components\Placeholder;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Foundation\Application; use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Illuminate\Support\HtmlString;
class GSLToken extends FeatureProvider class GSLToken extends FeatureProvider
{ {
@ -35,7 +38,7 @@ class GSLToken extends FeatureProvider
public function getId(): string public function getId(): string
{ {
return 'gsltoken'; return 'gsl_token';
} }
public function getAction(): Action public function getAction(): Action
@ -44,7 +47,9 @@ class GSLToken extends FeatureProvider
$server = Filament::getTenant(); $server = Filament::getTenant();
/** @var ServerVariable $serverVariable */ /** @var ServerVariable $serverVariable */
$serverVariable = $server->serverVariables()->where('env_variable', 'STEAM_ACC')->first(); $serverVariable = $server->serverVariables()->whereHas('variable', function (Builder $query) {
$query->where('env_variable', 'STEAM_ACC');
})->first();
return Action::make($this->getId()) return Action::make($this->getId())
->requiresConfirmation() ->requiresConfirmation()
@ -54,7 +59,7 @@ class GSLToken extends FeatureProvider
->disabledForm(fn () => !auth()->user()->can(Permission::ACTION_STARTUP_UPDATE, $server)) ->disabledForm(fn () => !auth()->user()->can(Permission::ACTION_STARTUP_UPDATE, $server))
->form([ ->form([
Placeholder::make('info') Placeholder::make('info')
->label('You can either <x-filament::link href="https://steamcommunity.com/dev/managegameservers" target="_blank">generate a new one</x-filament::link> and enter it below or leave the field blank to remove it completely.'), ->label(new HtmlString(Blade::render('You can either <x-filament::link href="https://steamcommunity.com/dev/managegameservers" target="_blank">generate a new one</x-filament::link> and enter it below or leave the field blank to remove it completely.'))),
TextInput::make('gsltoken') TextInput::make('gsltoken')
->label('GSL Token') ->label('GSL Token')
->rules([ ->rules([