Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 35
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
Kernel
0.00% covered (danger)
0.00%
0 / 35
0.00% covered (danger)
0.00%
0 / 2
20
0.00% covered (danger)
0.00%
0 / 1
 schedule
0.00% covered (danger)
0.00%
0 / 33
0.00% covered (danger)
0.00%
0 / 1
12
 commands
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Console;
4
5use Carbon\Carbon;
6use Illuminate\Console\Scheduling\Schedule;
7use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
8
9class Kernel extends ConsoleKernel
10{
11    /**
12     * Define the application's command schedule.
13     *
14     * @return void
15     */
16    protected function schedule(Schedule $schedule)
17    {
18        // $schedule->command('inspire')->hourly();
19        $schedule->command('presupuestos:sincronizar')->dailyAt('03:00');
20        $schedule->command('quotations:sync')
21            ->everyFiveMinutes()
22            ->weekdays(); // from monday to friday
23
24        $schedule->command('ifex-quotations:sync')
25            ->everyFiveMinutes()
26            ->weekdays(); // from monday to friday
27
28        $schedule->command('quotations:sync')
29            ->dailyAt('22:00')
30            ->weekends(); // saturday and sunday
31
32        $schedule->command('quotations:sync-work')->weeklyOn(6, '03:00');
33
34        $schedule->command('update:commercial-numbers')->everyMinute()->when(function () {
35            return now()->minute % 3 == 0;
36        });
37
38        $schedule->command('invoices:send-reminder')->dailyAt('08:00');
39
40        $schedule->command('invoices:call-center')->dailyAt('18:00');
41
42        $schedule->command('quotations:sync-missing')->dailyAt('06:01');
43
44        // FIRE-977 schedule lives in routes/console.php (Laravel 11+ convention)
45
46        $schedule->command('clear:email-processing')->everyTenMinutes();
47
48        $schedule->command('finance:import-drive')->weeklyOn(6, '04:00');
49
50        $schedule->command('finance:send-report')->weeklyOn(6, '06:00');
51
52        $schedule->command('finance:send-report --type=monthly')->monthlyOn(10, '06:00');
53
54        $schedule->command('administrators-invoices:sync')
55            ->dailyAt('11:00')
56            ->when(function () {
57                $today = Carbon::today();
58
59                if ($today->isWeekend()) {
60                    return false;
61                }
62
63                $firstDayOfMonth = Carbon::parse($today->year.'-'.$today->month.'-01');
64
65                $firstWorkDayOfMonth = $firstDayOfMonth;
66                while ($firstWorkDayOfMonth->isWeekend()) {
67                    $firstWorkDayOfMonth->addDay();
68                }
69
70                return $today->toDateString() === $firstWorkDayOfMonth->toDateString();
71            });
72    }
73
74    /**
75     * Register the commands for the application.
76     *
77     * @return void
78     */
79    protected function commands()
80    {
81        $this->load(__DIR__.'/Commands');
82
83        require base_path('routes/console.php');
84    }
85}