1 | <?php |
||
2 | |||
3 | namespace App\Mail; |
||
4 | |||
5 | use App\Models\User; |
||
6 | use App\Models\Institution_class; |
||
7 | use Illuminate\Bus\Queueable; |
||
8 | use Illuminate\Contracts\Mail\Mailer as MailerContract; |
||
9 | use Illuminate\Mail\Mailable; |
||
10 | use Illuminate\Queue\SerializesModels; |
||
11 | use Illuminate\Contracts\Queue\ShouldQueue; |
||
12 | |||
13 | class StudentCountExceeded extends Mailable |
||
14 | { |
||
15 | use Queueable, SerializesModels; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
16 | |||
17 | /** |
||
18 | * Create a new message instance. |
||
19 | * |
||
20 | * @return void |
||
21 | */ |
||
22 | public function __construct($file) |
||
23 | { |
||
24 | // $this->subject = 'SIS Bulk upload: Student count exceeded' . date('Y:m:d H:i:s'); |
||
25 | // $this->from = env('MAIL_USERNAME'); |
||
26 | // $this->to = [$user->first_name, $user->email]; |
||
27 | // $this->viewData = [ |
||
28 | // 'name'=>$user->first_name, "body" => "The class you tried to import data is exceeded the student count limit.Please check the class / increase the student limit" |
||
29 | // ]; |
||
30 | |||
31 | $institution = Institution_class::find($file['institution_class_id']); |
||
32 | |||
33 | $this->user = User::find($file['security_user_id']); |
||
0 ignored issues
–
show
|
|||
34 | $this->subject = 'SIS Bulk Upload: Upload Failed '.$institution->institution->code.': '. $institution->name . date('Y:m:d H:i:s'); |
||
0 ignored issues
–
show
|
|||
35 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
||
0 ignored issues
–
show
|
|||
36 | $this->from_name = 'SIS Bulk Uploader'; |
||
0 ignored issues
–
show
|
|||
37 | $this->with = [ |
||
0 ignored issues
–
show
|
|||
38 | 'name' => $this->user->first_name, |
||
39 | 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
||
40 | ]; |
||
41 | $this->viewData = [ |
||
42 | 'name'=>$this->user->first_name, "body" => "The class you tried to import data is exceeded the student count limit.Please check the class / increase the student limit", |
||
43 | 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
||
44 | ]; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Build the message. |
||
49 | * |
||
50 | * @return $this |
||
51 | */ |
||
52 | public function build() |
||
53 | { |
||
54 | return $this->view('emails.mail') |
||
55 | ->from($this->from_address,$this->from_name) |
||
56 | ->to($this->user->email) |
||
0 ignored issues
–
show
|
|||
57 | ->subject($this->subject) |
||
58 | ->with($this->with); |
||
59 | } |
||
60 | |||
61 | } |
||
62 |