58 lines
1.6 KiB
PHP
58 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Console;
|
|
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class Kernel extends ConsoleKernel
|
|
{
|
|
/**
|
|
* Define the application's command schedule.
|
|
*
|
|
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
|
* @return void
|
|
*/
|
|
protected function schedule(Schedule $schedule)
|
|
{
|
|
$schedule->command('digest:send --daily')
|
|
->daily()
|
|
->onFailure(function () {
|
|
Log::error("Daily email digest send failed");
|
|
});
|
|
|
|
$schedule->command('digest:send --weekly')
|
|
->weekly()
|
|
->onFailure(function () {
|
|
Log::error("Weekly email digest send failed");
|
|
});
|
|
|
|
$schedule->command('digest:send --fortnightly')
|
|
->weeklyOn(5, '00:01')
|
|
->when(function () {
|
|
return (time() / 604800 % 2);
|
|
})
|
|
->onFailure(function () {
|
|
Log::error("Fortnightly email digest send failed");
|
|
});
|
|
|
|
$schedule->command('digest:send --monthly')
|
|
->monthly()
|
|
->onFailure(function () {
|
|
Log::error("Monthly email digest send failed");
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Register the commands for the application.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function commands()
|
|
{
|
|
$this->load(__DIR__.'/Commands');
|
|
|
|
require base_path('routes/console.php');
|
|
}
|
|
}
|