laravel schedule hourlyAt code example

Example 1: laravel scheduler every 2 hours

// App\Console\Kernel::schedule()
$schedule->command('command')->cron('0 */2 * * *');

Example 2: laravel scheduler run

php artisan schedule:list
php artisan schedule:run

Example 3: laravel schedule

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Example 4: Laravel Scheduler

$schedule->call(function () {
            DB::table('users')->whereYear('last_login_at','<',date('Y')-1)->delete();
        })->daily();

Tags:

Php Example