Skip to content

Instantly share code, notes, and snippets.

@Kehet
Last active January 31, 2022 08:12
Show Gist options
  • Save Kehet/b2f187367fc4aa98db4064a40820bb7f to your computer and use it in GitHub Desktop.
Save Kehet/b2f187367fc4aa98db4064a40820bb7f to your computer and use it in GitHub Desktop.
<?php
namespace App\Console\Traits;
trait ArgumentOrAsk
{
public function argumentOrAsk($argumentName, $question = null, $default = null)
{
$argument = $this->argument($argumentName);
if (!empty($argument)) {
return $argument;
}
return $this->ask($question ?? $argumentName, $default);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment