Path: blob/1.0-develop/app/Console/Commands/Location/MakeLocationCommand.php
7461 views
<?php12namespace Pterodactyl\Console\Commands\Location;34use Illuminate\Console\Command;5use Pterodactyl\Services\Locations\LocationCreationService;67class MakeLocationCommand extends Command8{9protected $signature = 'p:location:make10{--short= : The shortcode name of this location (ex. us1).}11{--long= : A longer description of this location.}';1213protected $description = 'Creates a new location on the system via the CLI.';1415/**16* Create a new command instance.17*/18public function __construct(private LocationCreationService $creationService)19{20parent::__construct();21}2223/**24* Handle the command execution process.25*26* @throws \Pterodactyl\Exceptions\Model\DataValidationException27*/28public function handle()29{30$short = $this->option('short') ?? $this->ask(trans('command/messages.location.ask_short'));31$long = $this->option('long') ?? $this->ask(trans('command/messages.location.ask_long'));3233$location = $this->creationService->handle(compact('short', 'long'));34$this->line(trans('command/messages.location.created', [35'name' => $location->short,36'id' => $location->id,37]));38}39}404142