1 | <?php |
||
2 | |||
3 | namespace DavideCasiraghi\LaravelEventsCalendar\Mail; |
||
4 | |||
5 | use Illuminate\Bus\Queueable; |
||
6 | use Illuminate\Mail\Mailable; |
||
7 | use Illuminate\Queue\SerializesModels; |
||
8 | |||
9 | class ReportMisuse extends Mailable |
||
10 | { |
||
11 | use Queueable, SerializesModels; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
12 | |||
13 | /** |
||
14 | * The report instance. |
||
15 | * |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $report; |
||
19 | |||
20 | /** |
||
21 | * Create a new message instance. |
||
22 | * |
||
23 | * @return void |
||
24 | */ |
||
25 | public function __construct(array $report) |
||
26 | { |
||
27 | $this->report = $report; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Build the message. |
||
32 | * |
||
33 | * @return $this |
||
34 | */ |
||
35 | public function build() |
||
36 | { |
||
37 | // Configure email parameters in .env file |
||
38 | switch ($this->report['reason']) { |
||
39 | |||
40 | /* Send email to the user that has created the event */ |
||
41 | case 'It is not translated in english': |
||
42 | |||
43 | return $this->markdown('laravel-events-calendar::emails.misuse.organizer-event-not-english') |
||
44 | ->to($this->report['creatorEmail']) |
||
45 | ->from($this->report['senderEmail'], 'Global CI Calendar') |
||
46 | ->replyTo($this->report['senderEmail'], 'Global CI Calendar') |
||
47 | ->subject($this->report['subject']) |
||
48 | ->with([ |
||
49 | 'event_title' => $this->report['event_title'], |
||
50 | 'event_id' => $this->report['event_id'], |
||
51 | 'event_slug' => $this->report['event_slug'], |
||
52 | 'reason' => $this->report['reason'], |
||
53 | 'msg' => $this->report['message_misuse'], |
||
54 | ]); |
||
55 | |||
56 | break; |
||
0 ignored issues
–
show
break is not strictly necessary here and could be removed.
The switch ($x) {
case 1:
return 'foo';
break; // This break is not necessary and can be left off.
}
If you would like to keep this construct to be consistent with other ![]() |
|||
57 | |||
58 | /* Send email to the administrator */ |
||
59 | default: |
||
60 | |||
61 | return $this->markdown('laravel-events-calendar::emails.misuse.administrator-report-misuse') |
||
62 | ->from('[email protected]', 'Global CI Calendar') |
||
63 | ->replyTo('[email protected]', 'Global CI Calendar') |
||
64 | ->subject($this->report['subject']) |
||
65 | ->with([ |
||
66 | 'event_title' => $this->report['event_title'], |
||
67 | 'event_id' => $this->report['event_id'], |
||
68 | 'event_slug' => $this->report['event_slug'], |
||
69 | 'reason' => $this->report['reason'], |
||
70 | 'msg' => $this->report['message_misuse'], |
||
71 | ]); |
||
72 | |||
73 | break; |
||
74 | } |
||
75 | } |
||
76 | } |
||
77 |