File: D:/HostingSpaces/SBogers10/farmfun.komma.pro/app/Console/Kernel.php
<?php
namespace App\Console;
use App\Komma\Kiyoh\ArtisanCommands\ImportCommand;
use App\Komma\Reservations\ReservationService;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Support\Facades\Log;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
ImportCommand::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
/**
* When disabling the cronjob, dont forgot when enabling it again.
* To mark all the reservations that have been to mark as reminded ;)
*/
$schedule->call(function () {
app()->setLocale('nl');
/** @var ReservationService $reservationService */
$reservationService = app()->make(ReservationService::class);
$reservationService->sendClientInformation(today());
$reservationService->sendClientReminders(today());
$reservationService->sendClientSimpleReminders(today());
$reservationService->sendClientAlmostReady(today());
$reservationService->sendDayPlansToLocations(today()->addDays(config('site.send_day_plan_days')));
$reservationService->sendProgramReminders(today()->subDays(config('site.send_program_reminder_days')));
$reservationService->sendClientFavour(today());
Log::info('Cronjob has been runned.');
// Log::channel('slack')->info('Cronjob has been runned.');
})->dailyAt('16:00');
// Cron to get 25 last Kiyoh reviews once a day
$schedule->command('kiyoh:import --limit=100 --city=Aalter')->dailyAt('04:00');
$schedule->command('kiyoh:import --limit=100 --city=Bocholt')->dailyAt('04:10');
$schedule->command('kiyoh:import --limit=100 --city=Essen')->dailyAt('04:20');
$schedule->command('kiyoh:import --limit=100 --city=Geel')->dailyAt('04:30');
$schedule->command('kiyoh:import --limit=100 --city=Merchtem')->dailyAt('04:40');
$schedule->command('kiyoh:import --limit=100 --city=Poperinge')->dailyAt('04:50');
$schedule->command('kiyoh:import --limit=100 --city=Beveren-Waas')->dailyAt('05:00');
$schedule->command('kiyoh:import --limit=100 --city="Velp NB"')->dailyAt('05:10');
$schedule->command('kiyoh:import --limit=100 --city=Zwevegem')->dailyAt('05:20');
// $schedule->command('kiyoh:import --limit=100 --city=Aalter')->dailyAt('04:00')->after(function() { \Log::debug('Cron / Kernel: php artisan kiyoh:import --limit=25 --city=Aalter executed'); });
// $schedule->command('kiyoh:import --limit=100 --city=Bocholt')->dailyAt('04:10')->after(function() { \Log::debug('Cron / Kernel: php artisan kiyoh:import --limit=25 --city=Bocholt executed'); });
// $schedule->command('kiyoh:import --limit=100 --city=Essen')->dailyAt('04:20')->after(function() { \Log::debug('Cron / Kernel: php artisan kiyoh:import --limit=25 --city=Essen executed'); });
// $schedule->command('kiyoh:import --limit=100 --city=Geel')->dailyAt('04:30')->after(function() { \Log::debug('Cron / Kernel: php artisan kiyoh:import --limit=25 --city=Geel executed'); });
// $schedule->command('kiyoh:import --limit=100 --city=Merchtem')->dailyAt('04:40')->after(function() { \Log::debug('Cron / Kernel: php artisan kiyoh:import --limit=25 --city=Merchtem executed'); });
// $schedule->command('kiyoh:import --limit=100 --city=Poperinge')->dailyAt('04:50')->after(function() { \Log::debug('Cron / Kernel: php artisan kiyoh:import --limit=25 --city=Poperinge executed'); });
//Run the queue listener every hour, if it is still running, do nothing
// $schedule->command('queue:listen')->hourly()->withoutOverlapping()->after(function() {
// \Log::debug('Cron / Kernel: php artisan queue:listen executed');
// });
//
// $schedule->command('kms:housekeeper')->dailyAt('04:00')->after(function() {
// \Log::debug('Cron / Kernel: php artisan kms:housekeeper executed');
// }); //Does housekeeping. Cleaning up old stuff and such.
//
// $schedule->command('shop:catalog')->dailyAt('03:00')->after(function() {
// \Log::debug('Cron / Kernel: php artisan shop:catalog executed');
// }); //Update the shop catalog index
}
}