Skip to content

Instantly share code, notes, and snippets.

@razzul
Last active November 28, 2017 07:37
Show Gist options
  • Save razzul/b95f5f0d020909c8776522e468d7f87a to your computer and use it in GitHub Desktop.
Save razzul/b95f5f0d020909c8776522e468d7f87a to your computer and use it in GitHub Desktop.
Laravel console

php artisan make:command QuizStart --command=quiz:start

// /app/console/Kernel.php
protected $commands = [
    // Commands\Inspire::class,
    'App\Console\Commands\QuizStart'
];
/**
 * The name and signature of the console command.
 *
 * @var string
 */
protected $signature = 'quiz:start {user} {age} {--difficulty=} {--istest=}';
  • Argument: quiz:start {argument}.
  • Optional Argument (note the question mark next to the argument name): quiz:start {argument?}.
  • Argument with default value: quiz:start {argument=defaultValue}.
  • Boolean Option: quiz:start --myOption.
  • Option with Value: quiz:start --myOption=.
  • Option with Value and Default: quiz:start --myOption=12.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment