1
0
forked from poc/pds

changed logic for sending mails for only have schedule types in production report

This commit is contained in:
dhanabalan
2025-07-10 11:21:53 +05:30
parent 1597795c74
commit 752c3cb0da
2 changed files with 10 additions and 12 deletions

View File

@@ -141,31 +141,25 @@ Artisan::command('inspire', function () {
app()->booted(function () {
$schedule = app(Schedule::class);
// Get all production rules with logging
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
->where('rule_name', 'ProductionMail')
->get();
foreach ($productionRules as $rule) {
$command = $schedule->command("send:production-report");
$types = $productionRules->pluck('schedule_type')->unique();
switch ($rule->schedule_type) {
foreach ($types as $type) {
$command = $schedule->command("send:production-report", [$type]);
switch ($type) {
case 'Live':
$command->everyMinute();
// Log::info("Scheduled Live production report for");
break;
case 'Hourly':
$command->hourly();
//Log::info("Scheduled Hourly production report for {$rule->email}");
break;
case 'Daily':
$command->dailyAt('07:59');
// Log::info("Scheduled Daily production report for {$rule->email}");
break;
}
}
});