Skip to content

Commit

Permalink
Merge pull request #33 from laravel/fix/empty-list-of-options
Browse files Browse the repository at this point in the history
Avoids attempt to question when there is no answers available
  • Loading branch information
taylorotwell authored Sep 24, 2021
2 parents 0536409 + fd1b3e2 commit e7a2bcb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/Commands/Concerns/InteractsWithIO.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public function askForSite($question)

$answers = collect($this->forge->sites($this->currentServer()->id));

abort_if($answers->isEmpty(), 1, 'This server does not have any sites.');

if (! is_null($name)) {
return optional($answers->where('name', $name)->first())->id ?: $name;
}
Expand All @@ -67,6 +69,8 @@ public function askForServer($question)

$answers = collect($this->forge->servers());

abort_if($answers->isEmpty(), 1, 'This account does not have any servers.');

if (! is_null($name)) {
return optional($answers->where('name', $name)->first())->id ?: $name;
}
Expand All @@ -88,6 +92,8 @@ public function askForDaemon($question)

$answers = collect($this->forge->daemons($this->currentServer()->id));

abort_if($answers->isEmpty(), 1, 'This server does not have any daemons.');

if (! is_null($command)) {
return optional($answers->where('command', $command)->first())->id ?: $command;
}
Expand Down

0 comments on commit e7a2bcb

Please sign in to comment.