Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
6.45% covered (danger)
6.45%
2 / 31
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
Kernel
6.45% covered (danger)
6.45%
2 / 31
50.00% covered (danger)
50.00%
1 / 2
17.10
0.00% covered (danger)
0.00%
0 / 1
 schedule
0.00% covered (danger)
0.00%
0 / 29
0.00% covered (danger)
0.00%
0 / 1
12
 commands
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
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        $schedule->command('administrators-invoices:sync')
45            ->dailyAt('11:00')
46            ->when(function () {
47                $today = Carbon::today();
48
49                if ($today->isWeekend()) {
50                    return false;
51                }
52
53                $firstDayOfMonth = Carbon::parse($today->year.'-'.$today->month.'-01');
54
55                $firstWorkDayOfMonth = $firstDayOfMonth;
56                while ($firstWorkDayOfMonth->isWeekend()) {
57                    $firstWorkDayOfMonth->addDay();
58                }
59
60                return $today->toDateString() === $firstWorkDayOfMonth->toDateString();
61            });
62    }
63
64    /**
65     * Register the commands for the application.
66     *
67     * @return void
68     */
69    protected function commands()
70    {
71        $this->load(__DIR__.'/Commands');
72
73        require base_path('routes/console.php');
74    }
75}