Hi there,
I'm trying to create a scheduled task that runs once a month.
Not much is documented on it, so I'm trying to do some digging.
Here's what I got. So I extended/register the scheduler like bellow
(new Extend\Console())
->schedule(\M\MyExtension\Console\InitCommand::class, function (Event $event) {
$event->monthly();
} )
And then the command.
class InitCommand extends Command{
protected $signature = '???';
protected $description = 'Description of the command';
public function handle ()
{
//... code
}
}
Trying to understand how to structure it. This is pretty much from what I've seen in other examples. But I'm not entirely sure what this does and how this works.
So the Console and the schedule method register the scheduler with the event->monthly()
telling the scheduler this is something to run 1st of every month?
And the command class is the logic that is triggered by the scheduler? Is my understanding correct that the command class is where the logic I want to run should live?