Files
pds/app/Console/Commands/ScheduleList.php

56 lines
2.0 KiB
PHP

<?php
namespace App\Console\Commands;
use App\Models\AlertMailRule;
use Illuminate\Console\Scheduling\Schedule;
class ScheduleList
{
public function schedule(Schedule $schedule): void
{
// Invoice Report Scheduling
$scheduleType = AlertMailRule::where('module', 'InvoiceValidation')
->where('rule_name', 'InvoiceMailAlert')
->value('schedule_type');
switch ($scheduleType) {
case 'Live':
$schedule->command('send:invoice-report')->everyMinute()->runInBackground();
break;
case 'Hourly':
$schedule->command('send:invoice-report')->hourly()->runInBackground();
break;
// case 'Daily':
// $schedule->command('send:invoice-report')->daily()->runInBackground(); //->dailyAt('07:59')
// break;
case 'Daily':
$schedule->command('send:invoice-report')->dailyAt('07:59')->runInBackground(); //->dailyAt('07:59')
break;
default:
$schedule->command('send:invoice-report')->hourly()->runInBackground();
break;
}
// Production Report Scheduling
$productionScheduleType = AlertMailRule::where('module', 'ProductionQuantities')
->where('rule_name', 'ProductionMailAlert')
->value('schedule_type');
switch ($productionScheduleType) {
case 'Live':
$schedule->command('send:production-report')->everyMinute()->runInBackground();
break;
case 'Hourly':
$schedule->command('send:production-report')->hourly()->runInBackground();
break;
case 'Daily':
$schedule->command('send:production-report')->dailyAt('07:59')->runInBackground();
break;
default:
$schedule->command('send:production-report')->hourly()->runInBackground();
break;
}
}
}