3

As the official docs, it doesn't mention about this a lot. App\Console\Commands\PullUsersCommand.php has a signature like:

protected $signature = 'pull:users {startTime} {endTime} {minutes=10} {--flag} {--star=}';

So, how to pass the parameters to it in App\Console\Kernel.php

Alex Chiang
  • 1,800
  • 2
  • 14
  • 21

1 Answers1

6

You could call it in App\Console\Kernel.php like this:

$schedule->command('pull:users', [
    time(),  // captured with $this->argument('startTime') in command class.
    time(),  // captured with $this->argument('endTime') in command class.
    30,      // captured with $this->argument('minutes') in command class.
    '--flag',// should be without any value, just the option name, and would be captured by $this->option('minutes').
    '--star'=>12, // would be captured by $this->option('star').
])->daily();

It should be okay with Artisan::call facade too.

Alex Chiang
  • 1,800
  • 2
  • 14
  • 21