Issues (152)

app/Mail/ExceptionOccured.php (1 issue)

1
<?php
2
3
namespace App\Mail;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Mail\Mailable;
7
use Illuminate\Queue\SerializesModels;
8
9
class ExceptionOccured extends Mailable
10
{
11
    use Queueable;
12
    use SerializesModels;
0 ignored issues
show
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Mail\ExceptionOccured: $id, $class, $relations
Loading history...
13
14
    private $content;
15
16
    /**
17
     * Create a new message instance.
18
     *
19
     * @return void
20
     */
21
    public function __construct($content)
22
    {
23
        $this->content = $content;
24
    }
25
26
    /**
27
     * Build the message.
28
     *
29
     * @return $this
30
     */
31
    public function build()
32
    {
33
        $emailsTo = str_getcsv(config('exceptions.emailExceptionsTo'), ',');
34
        $ccEmails = str_getcsv(config('exceptions.emailExceptionCCto'), ',');
35
        $bccEmails = str_getcsv(config('exceptions.emailExceptionBCCto'), ',');
36
        $fromSender = config('exceptions.emailExceptionFrom');
37
        $subject = config('exceptions.emailExceptionSubject');
38
39
        if ($emailsTo[0] == null) {
40
            $emailsTo = config('exceptions.emailExceptionsToDefault');
41
        }
42
43
        if ($ccEmails[0] == null) {
44
            $ccEmails = config('exceptions.emailExceptionCCtoDefault');
45
        }
46
47
        if ($bccEmails[0] == null) {
48
            $bccEmails = config('exceptions.emailExceptionBCCtoDefault');
49
        }
50
51
        if (!$fromSender) {
52
            $fromSender = config('exceptions.emailExceptionFromDefault');
53
        }
54
55
        if (!$subject) {
56
            $subject = config('exceptions.emailExceptionSubjectDefault');
57
        }
58
59
        return $this->from($fromSender)
60
                    ->to($emailsTo)
61
                    ->cc($ccEmails)
62
                    ->bcc($bccEmails)
63
                    ->subject($subject)
64
                    ->view(config('exceptions.emailExceptionView'))
65
                    ->with('content', $this->content);
66
    }
67
}
68