Files
pterodactyl-panel/app/Console/Commands/Themes/ApplyCommand.php
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

32 lines
962 B
PHP

<?php
declare(strict_types=1);
namespace Pterodactyl\Console\Commands\Themes;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Pterodactyl\Contracts\Themes\AppliesThemes;
use Pterodactyl\Exceptions\Extensions\InvalidExtensionException;
#[Description('Apply a theme by publishing its token overrides.')]
#[Signature('p:theme:apply {id : The theme identifier.}')]
class ApplyCommand extends Command
{
public function handle(AppliesThemes $themes): int
{
try {
$themes->apply($this->argument('id'));
} catch (InvalidExtensionException $invalidExtensionException) {
$this->components->error($invalidExtensionException->getMessage());
return self::FAILURE;
}
$this->components->info(sprintf('Theme "%s" applied. Reload the panel to see it.', $this->argument('id')));
return self::SUCCESS;
}
}