52 lines
1.5 KiB
PHP
Executable File
52 lines
1.5 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Console;
|
|
|
|
use App\Jobs\DeductLeaveDays;
|
|
use App\Jobs\AddMonthlyLeaveDays;
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|
|
|
class Kernel extends ConsoleKernel
|
|
{
|
|
protected $commands = [
|
|
\App\Console\Commands\InitializeLeaveDaysCommand::class,
|
|
];
|
|
|
|
|
|
/**
|
|
* Define the application's command schedule.
|
|
*/
|
|
protected function schedule(Schedule $schedule): void
|
|
{
|
|
$schedule->command('clean_logs')->daily();
|
|
// Chạy command 'daily:api-call' vào mỗi ngày lúc 9h sáng
|
|
// $schedule->command('daily:api-call')
|
|
// ->dailyAt('18:00');
|
|
|
|
// Chạy command vào ngày 31/12 lúc 23:59:59 mỗi năm
|
|
$schedule->command('initialize:leavedays')->yearlyOn(12, 31, '23:59:59');
|
|
$schedule->command('leave:deduct')->yearlyOn(3, 31, '23:59:59');
|
|
|
|
// Chạy buổi sáng lúc 12:00
|
|
$schedule->command('attendance:check S')->dailyAt('12:00');
|
|
|
|
// Chạy buổi chiều lúc 17:30
|
|
$schedule->command('attendance:check C')->dailyAt('17:30');
|
|
|
|
// Chạy vào ngày đầu tiên của mỗi tháng
|
|
$schedule->command('add:monthly-leavedays')->monthlyOn(1, '00:01');
|
|
$schedule->command('update:temporary-leavedays')->monthlyOn(1, '00:05');
|
|
}
|
|
|
|
/**
|
|
* Register the commands for the application.
|
|
*/
|
|
protected function commands(): void
|
|
{
|
|
$this->load(__DIR__ . '/Commands');
|
|
|
|
require base_path('routes/console.php');
|
|
}
|
|
}
|