*/ protected Collection $allLocations; /** * Respond to the command request. * * @throws HasActiveNodesException */ public function handle(DeletesLocations $locations): void { $this->allLocations ??= Location::all(); $short = $this->option('short') ?? $this->anticipate( trans('command/messages.location.ask_short'), $this->allLocations->pluck('short')->toArray() ); $location = $this->allLocations->where('short', $short)->first(); if ($location === null) { $this->error(trans('command/messages.location.no_location_found')); if ($this->input->isInteractive()) { $this->handle($locations); } return; } $locations->delete($location); $this->line(trans('command/messages.location.deleted')); } }