Answers for "laravel scheduler run"

PHP
1

laravel scheduler run

php artisan schedule:list
php artisan schedule:run
Posted by: Guest on May-08-2021
1

laravel run schedule only on production

if (App::environment('production')) {
   $schedule->command('file:generate')
         ->daily();
   //run your commands here

}
Posted by: Guest on July-29-2021
0

test laravel scheduler

Set the cron to run after every minute:
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
  
Then inisde you kernel.php
//For every minute
$schedule->call(function () {
	Log::info('I ran after every 1 minute');
})->everyMinute();
//For every five minute
$schedule->call(function () {
	Log::info('I ran after every 5 minute');
})->everyFiveMinutes();
Posted by: Guest on December-12-2020
2

Laravel Scheduler

$schedule->call(function () {
            DB::table('users')->whereYear('last_login_at','<',date('Y')-1)->delete();
        })->daily();
Posted by: Guest on May-10-2020

Browse Popular Code Answers by Language