Merge branch 'dillon/34.3-jenkins-vapor' into vapor/development

This commit is contained in:
Dillon Ngo
2024-05-25 01:48:14 +08:00
@@ -36,26 +36,47 @@ class PaymentProofUploadedEmail extends AbstractEmail
public function toMail()
{
$attachedFile = null;
$file_info = $this->file->getFileAttribute($this->file)->file->file_info;
foreach ($file_info as $fileCount => $fileVal) {
if (isset($fileVal->original)) {
$file_path = $fileVal->original->file;
$mailMessage = (new MailMessage)->subject('Transfer Completed (REF: ' . $this->booking->marking . ')');
// $filesystemDriver = Storage::getDefaultDriver();
// if($filesystemDriver === 's3'){
// $fileContent = Storage::disk('s3')->get('documents/'.$file_path);
// }
// else{
// $attachedFile = storage_path('app/documents/' . $file_path);
// }
}
}
// STEP 1: Get file to be attached to email
// $attachedFile = null;
// $file_path = '';
// $file_info = $this->file->getFileAttribute($this->file)->file->file_info;
// foreach ($file_info as $fileCount => $fileVal) {
// if (isset($fileVal->original)) {
// $file_path = $fileVal->original->file;
// //$attachedFile = storage_path('app/documents/' . $file_path);
// }
// }
return (new MailMessage)
->subject('Transfer Completed (REF: ' . $this->booking->marking . ')')
// ->attach($attachedFile) // todo-new: add attachement
->view('emails.accounts.payment_proof_email', ['user' => $this->user, 'booking' => $this->booking]);
// STEP 2: Check whether to fetch from S3 bucket or local storage
// if($file_path){
// $filesystemDriver = Storage::getDefaultDriver();
// if($filesystemDriver === 's3'){
// $fileContent = null;
// $fileContent = Storage::disk('s3')->get('documents/' . $file_path);
// if ($fileContent) {
// $mailMessage->attachData($fileContent, 'invoice.pdf', [
// 'mime' => 'application/pdf',
// ]);
// }
// }
// else{
// $filePath = '';
// // $fileContent = Storage::disk('documents')->get($invoiceDocument->first()->file->file_info->original->file);
// $filePath = storage_path('app/documents/' . $file_path);
// if ($filePath) {
// $mailMessage->attach($filePath, [
// 'as' => 'invoice.pdf',
// 'mime' => 'application/pdf',
// ]);
// }
// }
// }
$mailMessage->view('emails.accounts.payment_proof_email', ['user' => $this->user, 'booking' => $this->booking]);
return $mailMessage;
}