moses's avatar
Level 2

How can I test my cron job in localhost windows? (laravel 5.3)

I create a cron job on laravel 5.3 by editing app\Console\Kernel.php like this :

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use DB;

class Kernel extends ConsoleKernel
{
    protected $commands = [
        //
    ];

    protected function schedule(Schedule $schedule)
    {
        $schedule->call(function () {
            $id = 1;
            DB::table('orders')
              ->where('id', $id)
              ->update(['status ' => 2, 'canceled_at' => date("Y-m-d H:i:s")]);
        })->everyMinute();
    }

    protected function commands()
    {
        require base_path('routes/console.php');
    }
}

I tried to check on the table in the database, but it does not update

How can I test my cron job?

0 likes
2 replies

Please or to participate in this conversation.