Email::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 0 Features 2
Metric Value
c 5
b 0
f 2
dl 0
loc 11
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace App\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Support\Facades\Mail;
7
8
/**
9
 * Task to send an email
10
 * Class Email.
11
 */
12
class Email extends Command
13
{
14
    /**
15
     * The name and signature of the console command.
16
     *
17
     * @var string
18
     */
19
    protected $signature = 'email:send {email} {nom=Boyer}';
20
21
    /**
22
     * The console command description.
23
     *
24
     * @var string
25
     */
26
    protected $description = 'Send an email for an use';
27
28
    /**
29
     * Execute the console command.
30
     *
31
     * @return mixed
32
     */
33
    public function handle()
34
    {
35
        $email = $this->argument('email');
36
        $nom = $this->argument('nom');
37
        Mail::send('Emails/welcome', [], function ($m) use ($email, $nom) {
38
            $m->to($email, $nom)
39
                ->subject('Welcome to the site ');
40
        });
41
42
        $this->info('Finish: Send a email');
43
    }
44
}
45