Added import transit excel attachment logic in mail
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 2m11s
Laravel Larastan / larastan (pull_request) Failing after 3m28s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 2m11s
Laravel Larastan / larastan (pull_request) Failing after 3m28s
This commit is contained in:
@@ -9,6 +9,7 @@ use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Mail\Mailables\Attachment;
|
||||
|
||||
class ImportTransitMail extends Mailable
|
||||
{
|
||||
@@ -20,14 +21,17 @@ class ImportTransitMail extends Mailable
|
||||
|
||||
public $mailSubject;
|
||||
|
||||
public $excelPath;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($scheduleType, $tableData, $mailSubject)
|
||||
public function __construct($scheduleType, $tableData, $mailSubject, $excelPath)
|
||||
{
|
||||
$this->scheduleType = $scheduleType;
|
||||
$this->tableData = $tableData ?? [];
|
||||
$this->mailSubject = $mailSubject ?? 'Import Transit';
|
||||
$this->excelPath = $excelPath;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,6 +94,14 @@ class ImportTransitMail extends Mailable
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
return [
|
||||
Attachment::fromStorageDisk(
|
||||
'local',
|
||||
$this->excelPath
|
||||
)->as('Import_Transit_Report.xlsx')
|
||||
->withMime(
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user