Kernel   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
dl 0
loc 42
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A commands() 0 5 1
A schedule() 0 9 2
1
<?php
2
3
namespace App\Console;
4
5
use App\Mail\HelloUser;
6
use Carbon\Carbon;
7
use Illuminate\Console\Scheduling\Schedule;
8
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
9
use Illuminate\Support\Facades\Mail;
10
11
class Kernel extends ConsoleKernel
12
{
13
    private $date = '2018-03-20';
14
15
    /**
16
     * The Artisan commands provided by your application.
17
     *
18
     * @var array
19
     */
20
    protected $commands = [
21
        //
22
    ];
23
24
    /**
25
     * Define the application's command schedule.
26
     *
27
     * @param \Illuminate\Console\Scheduling\Schedule $schedule
28
     *
29
     * @return void
30
     */
31
    protected function schedule(Schedule $schedule)
32
    {
33
        // $schedule->command('inspire')
34
        //          ->hourly();
35
36
        if (substr(Carbon::now(), 0, 10) === $this->date) {
37
            $schedule->call(function () {
38
                Mail::to('[email protected]')->send(new HelloUser());
39
            })->at('08:00');
40
        }
41
    }
42
43
    /**
44
     * Register the commands for the application.
45
     *
46
     * @return void
47
     */
48
    protected function commands()
49
    {
50
        $this->load(__DIR__.'/Commands');
51
52
        require base_path('routes/console.php');
53
    }
54
}
55