私は窓を使用しています。私のcronジョブlaravel 5.3がlocalhostで動作しないのはなぜですか?
\app\Console\Kernel.php
上の私のコードは次のようである:私は私のcronを見つけた後、私のcronジョブ
を見るためにphp artisan list
を実行
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
class CustomCommand extends Command
{
protected $signature = 'custom:command';
protected $description = 'test cron job to update status on table order';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$id = 1;
DB::table('orders')
->where('id', $id)
->update(['status' => 2, 'canceled_at' => date("Y-m-d H:i:s")]);
}
}
:\app\Console\Commands\CustomCommand.php
上
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
protected $commands = [
Commands\CustomCommand::class,
];
protected function schedule(Schedule $schedule)
{
$schedule->command('custom:command')
->everyMinute();
}
protected function commands()
{
require base_path('routes/console.php');
}
}
私のコードこのようなものですジョブ(カスタム:コマンド)を実行すると、次のようにcronジョブが実行されます。php artisan custom:command
更新ステータスは2です。その後、手動でステータスを1に変更した後、1分待ってステータスを再度更新しません。
誰かが私を助けることができますか?