Last active
January 31, 2022 08:12
-
-
Save Kehet/b2f187367fc4aa98db4064a40820bb7f 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
<?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