-
-
Save mariowhowrites/a98e597ece59e2e233dd5cd26b02432e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RemoveCoinCommand extends Command | |
{ | |
/** | |
* The name and signature of the console command. | |
* | |
* @var string | |
*/ | |
protected $name = 'remove'; | |
/** | |
* Execute the console command. | |
* | |
* @return void | |
*/ | |
public function handle($arguments) | |
{ | |
if (empty($arguments)) { | |
$this->replyWithMessage(['text' => 'Please enter a coin.']); | |
return; | |
} | |
$coin = Coin::find([$arguments])->first(); | |
if ($coin) { | |
$coin->active = false; | |
$coin->save(); | |
} | |
$message = $coin ? "Purged! $coin->ticker has been mercilessly removed from the list." : "No coin on the list by that ticker. Did you mean to add?"; | |
$this->replyWithMessage(['text' => $message]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment