SendContact::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
1
<?php
2
3
namespace App\Mail\Frontend\Contact;
4
5
use App\Http\Requests\Request;
6
use Illuminate\Bus\Queueable;
7
use Illuminate\Mail\Mailable;
8
use Illuminate\Queue\SerializesModels;
9
10
/**
11
 * Class SendContact.
12
 */
13
class SendContact extends Mailable
14
{
15
    use Queueable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Mail\Frontend\Contact\SendContact: $id, $class
Loading history...
16
17
    /**
18
     * @var Request
19
     */
20
    public $request;
21
22
    /**
23
     * SendContact constructor.
24
     *
25
     * @param Request $request
26
     */
27
    public function __construct(Request $request)
28
    {
29
        $this->request = $request;
30
    }
31
32
    /**
33
     * Build the message.
34
     *
35
     * @return $this
36
     */
37
    public function build()
38
    {
39
        return $this->to(config('mail.from.address'), config('mail.from.name'))
40
            ->view('frontend.mail.contact')
41
            ->text('frontend.mail.contact-text')
42
            ->subject(trans('strings.emails.contact.subject', ['app_name' => app_name()]))
0 ignored issues
show
Bug introduced by
It seems like trans('strings.emails.co...p_name' => app_name())) can also be of type array; however, parameter $subject of Illuminate\Mail\Mailable::subject() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

42
            ->subject(/** @scrutinizer ignore-type */ trans('strings.emails.contact.subject', ['app_name' => app_name()]))
Loading history...
43
            ->from($this->request->email, $this->request->name)
44
            ->replyTo($this->request->email, $this->request->name);
45
    }
46
}
47