1if (App::environment('production')) {
2 $schedule->command('file:generate')
3 ->daily();
4 //run your commands here
5
6}
1Set the cron to run after every minute:
2* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
3
4Then inisde you kernel.php
5//For every minute
6$schedule->call(function () {
7 Log::info('I ran after every 1 minute');
8})->everyMinute();
9//For every five minute
10$schedule->call(function () {
11 Log::info('I ran after every 5 minute');
12})->everyFiveMinutes();
1$schedule->call(function () {
2 DB::table('users')->whereYear('last_login_at','<',date('Y')-1)->delete();
3 })->daily();