Laravel - Task Scheduling - Defining Schedules

You may define all of your scheduled tasks in the schedule method of your application's App\Console\Kernel class. To get started, let's take a look at an example. In this example, we will schedule a closure to be called every day at midnight. Within the closure we will execute a database query to clear a table:

    
    call(function () {
                DB::table('recent_users')->delete();
            })->daily();
        }
    }
	

In addition to scheduling using closures, you may also schedule invokable objects. Invokable objects are simple PHP classes that contain an __invoke method:

    
    $schedule->call(new DeleteRecentUsers)->daily();
	

If you would like to view an overview of your scheduled tasks and the next time they are scheduled to run, you may use the schedule:list Artisan command:

    
    php artisan schedule:list