1 | <?php |
||
2 | |||
3 | namespace App\Mail; |
||
4 | |||
5 | use App\Models\Institution_class; |
||
6 | use App\Models\User; |
||
7 | use Illuminate\Bus\Queueable; |
||
8 | use Illuminate\Mail\Mailable; |
||
9 | use Illuminate\Queue\SerializesModels; |
||
10 | |||
11 | class TerminatedReport extends Mailable |
||
12 | { |
||
13 | use Queueable, SerializesModels; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
14 | |||
15 | /** |
||
16 | * Create a new message instance. |
||
17 | * |
||
18 | * @return void |
||
19 | */ |
||
20 | public function __construct($file) |
||
21 | { |
||
22 | |||
23 | $institution = Institution_class::find($file['institution_class_id']); |
||
24 | $this->user = User::find($file['security_user_id']); |
||
0 ignored issues
–
show
|
|||
25 | $this->subject = 'SIS Bulk Upload: Process Terminated'.$institution->institution->code.': '. $institution->name.' '. date('Y:m:d H:i:s'); |
||
0 ignored issues
–
show
|
|||
26 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
||
0 ignored issues
–
show
|
|||
27 | $this->from_name = 'SIS Bulk Uploader'; |
||
0 ignored issues
–
show
|
|||
28 | $this->with = [ |
||
0 ignored issues
–
show
|
|||
29 | 'name' => $this->user->first_name, |
||
30 | 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
||
31 | ]; |
||
32 | $this->viewData = [ |
||
33 | 'name'=>$this->user->first_name, "body" => "Apologize ,The process of you file has been terminated in the middle, |
||
34 | We advice you to check the student data and re-upload with only with correct data which are not in the system ", |
||
35 | 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
||
36 | ]; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Build the message. |
||
41 | * |
||
42 | * @return $this |
||
43 | */ |
||
44 | public function build() |
||
45 | { |
||
46 | return $this->view('emails.mail') |
||
47 | ->from($this->from_address,$this->from_name) |
||
48 | ->to($this->user->email) |
||
0 ignored issues
–
show
|
|||
49 | ->subject($this->subject) |
||
50 | ->with($this->with); |
||
51 | } |
||
52 | } |
||
53 |