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\Mail\Mailable; |
||
9 | use Illuminate\Queue\SerializesModels; |
||
10 | use Illuminate\Contracts\Queue\ShouldQueue; |
||
11 | |||
12 | class EmptyFile extends Mailable |
||
13 | { |
||
14 | use Queueable, SerializesModels; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
15 | |||
16 | /** |
||
17 | * Create a new message instance. |
||
18 | * |
||
19 | * @return void |
||
20 | */ |
||
21 | public function __construct($file) |
||
22 | { |
||
23 | |||
24 | $institution = Institution_class::find($file['institution_class_id']); |
||
25 | |||
26 | |||
27 | $this->user = User::find($file['security_user_id']); |
||
0 ignored issues
–
show
|
|||
28 | $this->subject = 'SIS Bulk Upload: ' .$file['subject'].' Empty ' . $institution->institution->code.': '. $institution->name.' '. date('Y:m:d H:i:s'); |
||
0 ignored issues
–
show
|
|||
29 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
||
0 ignored issues
–
show
|
|||
30 | $this->from_name = 'SIS Bulk Uploader'; |
||
0 ignored issues
–
show
|
|||
31 | $this->with = [ |
||
0 ignored issues
–
show
|
|||
32 | 'name' => $this->user->first_name, |
||
33 | 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL') : env('APP_URL').'/bulk-upload/' |
||
34 | ]; |
||
35 | $this->viewData = [ |
||
36 | 'name'=>$this->user->first_name, "body" => "No data Found in ". $file['filename']. ' Please re-upload the file with data', |
||
37 | 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL') : env('APP_URL').'/bulk-upload/' |
||
38 | ]; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Build the message. |
||
43 | * |
||
44 | * @return $this |
||
45 | */ |
||
46 | public function build() |
||
47 | { |
||
48 | return $this->view('emails.mail') |
||
49 | ->from($this->from_address,$this->from_name) |
||
50 | ->to($this->user->email) |
||
0 ignored issues
–
show
|
|||
51 | ->subject($this->subject) |
||
52 | ->with($this->with); |
||
53 | } |
||
54 | |||
55 | } |
||
56 |