diff --git a/app/Console/Commands/SendImportTransit.php b/app/Console/Commands/SendImportTransit.php
index 05d16f1..43fed64 100644
--- a/app/Console/Commands/SendImportTransit.php
+++ b/app/Console/Commands/SendImportTransit.php
@@ -4,8 +4,10 @@ namespace App\Console\Commands;
use App\Mail\ImportTransitMail;
use App\Models\AlertMailRule;
+use App\Models\EmployeeMaster;
use App\Models\ImportTransit;
use App\Models\Plant;
+use Filament\Facades\Filament;
use Illuminate\Console\Command;
use Maatwebsite\Excel\Facades\Excel;
use App\Exports\ImportTransitReportExport;
@@ -81,11 +83,22 @@ class SendImportTransit extends Command
'local'
);
+ $updatedBy = $tableData->last()?->updated_by;
+
+ $employee = EmployeeMaster::where('code', $updatedBy)
+ ->select('name', 'mobile_number')
+ ->first();
+
+ $employeeName = $employee?->name;
+ $mobileNumber = $employee?->mobile_number;
+
$mail = new ImportTransitMail(
$scheduleType,
$tableData,
$mailSubject,
- $fileName
+ $fileName,
+ $employeeName,
+ $mobileNumber,
);
$toEmails = collect(explode(',', $rule->email))
@@ -111,11 +124,9 @@ class SendImportTransit extends Command
->cc($ccEmails)
->send($mail);
- $this->info(
- "Mail sent → Rule {$rule->id} | To: " . implode(', ', $toEmails)
- );
- }
+ $this->info("Mail sent → Rule {$rule->id} | To: " . implode(', ', $toEmails));
+ }
}
}
}
diff --git a/app/Mail/ImportTransitMail.php b/app/Mail/ImportTransitMail.php
index ca9b381..291cdbf 100644
--- a/app/Mail/ImportTransitMail.php
+++ b/app/Mail/ImportTransitMail.php
@@ -23,15 +23,21 @@ class ImportTransitMail extends Mailable
public $excelPath;
+ public $name;
+
+ public $mobileNo;
+
/**
* Create a new message instance.
*/
- public function __construct($scheduleType, $tableData, $mailSubject, $excelPath)
+ public function __construct($scheduleType, $tableData, $mailSubject, $excelPath, $name, $mobileNo)
{
$this->scheduleType = $scheduleType;
$this->tableData = $tableData ?? [];
$this->mailSubject = $mailSubject ?? 'Import Transit';
$this->excelPath = $excelPath;
+ $this->name = $name;
+ $this->mobileNo = $mobileNo;
}
/**
@@ -81,7 +87,7 @@ class ImportTransitMail extends Mailable
'company' => 'CRI Digital Manufacturing Solutions',
'greeting' => $greeting,
'tableData' => $this->tableData,
- 'wishes' => 'Thanks & Regards,
CRI Digital Manufacturing Solutions',
+ 'wishes' => "Thanks & Regards,
CRI Digital Manufacturing Solutions
Updated By - $this->name
For any queries, please contact the number below
+91 $this->mobileNo",
],
);
}