Issues (350)

app/Mail/AbsenceNotification.php (2 issues)

1
<?php
2
3
namespace App\Mail;
4
5
use App\Models\Enrollment;
6
use App\Models\Event;
7
use App\Models\Student;
8
use App\Models\User;
9
use Illuminate\Bus\Queueable;
10
use Illuminate\Mail\Mailable;
11
use Illuminate\Queue\SerializesModels;
12
13
class AbsenceNotification extends Mailable
14
{
15
    use Queueable;
16
    use SerializesModels;
0 ignored issues
show
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Mail\AbsenceNotification: $id, $relations, $class, $keyBy
Loading history...
17
18
    public $enrollment;
19
20
    /**
21
     * Create a new message instance.
22
     *
23
     * @return void
24
     */
25
    public function __construct(public Event $event, public User $student)
26
    {
27
        $nstudent = Student::where('id', $student->id)->first();
28
        $this->enrollment = Enrollment::where('student_id', $nstudent->id)->where('course_id', $event->course_id)->first();
29
    }
30
31
    /**
32
     * Build the message.
33
     *
34
     * @return $this
35
     */
36
    public function build()
37
    {
38
        return $this
39
            ->subject(__('Absence Notification'))
0 ignored issues
show
It seems like __('Absence Notification') can also be of type array and 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

39
            ->subject(/** @scrutinizer ignore-type */ __('Absence Notification'))
Loading history...
40
            ->view('emails.absence_notification');
41
    }
42
}
43