NewCandidateNotification   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
c 0
b 0
f 0
dl 0
loc 44
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubject() 0 7 1
A build() 0 5 1
A getCvPath() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace App\Mail;
4
5
use App\Models\Candidate;
6
use App\Utils\UtilsService;
7
use Illuminate\Bus\Queueable;
8
use Illuminate\Mail\Mailable;
9
10
class NewCandidateNotification extends Mailable
11
{
12
    use Queueable;
13
14
    /**
15
     * @var Candidate
16
     */
17
    public $candidate;
18
19
    /**
20
     * Create a new message instance.
21
     *
22
     * @return void
23
     */
24
    public function __construct(Candidate $candidate)
25
    {
26
        $this->candidate = $candidate;
27
    }
28
29
    /**
30
     * Build the message.
31
     *
32
     * @return $this
33
     */
34
    public function build()
35
    {
36
        return $this
37
            ->subject($this->getSubject())
38
            ->view('emails.new_candidate');
39
        //->attach($this->getCvPath());
40
    }
41
42
    protected function getSubject()
43
    {
44
        $position = $this->candidate->recruitment->name;
45
        $candidate = $this->candidate->name;
46
        $hashSuffix = UtilsService::hashSuffix($this->candidate->id);
47
48
        return "[HR] $position - $candidate $hashSuffix";
49
    }
50
51
    protected function getCvPath()
52
    {
53
        return storage_path('app/'.$this->candidate->path_to_cv);
54
    }
55
}
56