$ php artisan make:command TestBatch
-> app/Console/Commands に TestBatch.phpが出来ます。
protected $signature = 'batch:test';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
echo "hello";
}
$ php artisan list
batch
batch:test Command description
$ php artisan batch:test
hello
あとはsudo vi /etc/crontab で、$ php artisan batch:testを実行すればいいだけ。
そうだ、思い出した。