Completed
Push — master ( 5c637a...214bce )
by Julien
03:47
created

Email::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

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