Merge pull request 'Added msg in import transit mail' (#794) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 24s

Reviewed-on: #794
This commit was merged in pull request #794.
This commit is contained in:
2026-07-01 04:22:24 +00:00
2 changed files with 24 additions and 7 deletions

View File

@@ -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));
}
}
}
}

View File

@@ -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,<br>CRI Digital Manufacturing Solutions',
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions<br><b>Updated By</b> - $this->name<br>For any queries, please contact the number below<br>+91 $this->mobileNo",
],
);
}