cbcf62086f
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Pterodactyl\Console\Commands\Location;
|
|
|
|
use Illuminate\Console\Command;
|
|
use Pterodactyl\Services\Locations\LocationCreationService;
|
|
|
|
class MakeLocationCommand extends Command
|
|
{
|
|
protected $signature = 'p:location:make
|
|
{--short= : The shortcode name of this location (ex. us1).}
|
|
{--long= : A longer description of this location.}';
|
|
|
|
protected $description = 'Creates a new location on the system via the CLI.';
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*/
|
|
public function __construct(private LocationCreationService $creationService)
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Handle the command execution process.
|
|
*
|
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
|
*/
|
|
public function handle()
|
|
{
|
|
$short = $this->option('short') ?? $this->ask(trans('command/messages.location.ask_short'));
|
|
$long = $this->option('long') ?? $this->ask(trans('command/messages.location.ask_long'));
|
|
|
|
$location = $this->creationService->handle(compact('short', 'long'));
|
|
$this->line(trans('command/messages.location.created', [
|
|
'name' => $location->short,
|
|
'id' => $location->id,
|
|
]));
|
|
}
|
|
}
|