Refactor console.php to clean up commented-out scheduling code
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 24s
Laravel Pint / pint (pull_request) Successful in 2m40s
Laravel Larastan / larastan (pull_request) Failing after 3m25s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Gemini PR Review / review (pull_request) Failing after 24s
Laravel Pint / pint (pull_request) Successful in 2m40s
Laravel Larastan / larastan (pull_request) Failing after 3m25s
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\AlertMailRule;
|
use App\Models\AlertMailRule;
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
use Illuminate\Foundation\Inspiring;
|
use Illuminate\Foundation\Inspiring;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
Artisan::command('inspire', function () {
|
Artisan::command('inspire', function () {
|
||||||
@@ -11,95 +11,90 @@ Artisan::command('inspire', function () {
|
|||||||
})->purpose('Display an inspiring quote');
|
})->purpose('Display an inspiring quote');
|
||||||
|
|
||||||
// Schedule::command('send:invoice-report');
|
// Schedule::command('send:invoice-report');
|
||||||
// Schedule::command('send:production-report');
|
// Schedule::command('send:production-report');
|
||||||
|
|
||||||
|
// app()->booted(function () {
|
||||||
|
// $schedule = app(Schedule::class);
|
||||||
|
|
||||||
|
// // $schedule->command('report:send-daily-production')->dailyAt('07:59');
|
||||||
|
|
||||||
|
// if (Schema::hasTable('alert_mail_rules')) {
|
||||||
|
|
||||||
app()->booted(function () {
|
// // Production report scheduling
|
||||||
$schedule = app(Schedule::class);
|
// $productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
||||||
|
// ->where('rule_name', 'ProductionMail')
|
||||||
|
// ->select('plant', 'schedule_type')
|
||||||
|
// ->distinct()
|
||||||
|
// ->get();
|
||||||
|
|
||||||
//$schedule->command('report:send-daily-production')->dailyAt('07:59');
|
// foreach ($productionRules as $rule) {
|
||||||
|
// $type = $rule->schedule_type;
|
||||||
|
// $plantId = $rule->plant;
|
||||||
|
|
||||||
if (Schema::hasTable('alert_mail_rules')) {
|
// $command = $schedule->command('send:production-report', [$type, $plantId]);
|
||||||
|
// // ->appendOutputTo(storage_path('logs/scheduler.log'));
|
||||||
|
|
||||||
//Production report scheduling
|
// switch ($type) {
|
||||||
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
// case 'Live':
|
||||||
->where('rule_name', 'ProductionMail')
|
// $command->everyMinute();
|
||||||
->select('plant', 'schedule_type')
|
// break;
|
||||||
->distinct()
|
// case 'Hourly':
|
||||||
->get();
|
// $command->hourly();
|
||||||
|
// break;
|
||||||
|
// case 'Daily':
|
||||||
|
// $command->dailyAt('07:59');
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
foreach ($productionRules as $rule) {
|
// // Invoice report scheduling
|
||||||
$type = $rule->schedule_type;
|
// $invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||||
$plantId = $rule->plant;
|
// ->select('plant', 'schedule_type')
|
||||||
|
// ->distinct()
|
||||||
|
// ->get();
|
||||||
|
|
||||||
$command = $schedule->command('send:production-report', [$type, $plantId]);
|
// foreach ($invoiceRules as $rule) {
|
||||||
//->appendOutputTo(storage_path('logs/scheduler.log'));
|
// $type = $rule->schedule_type;
|
||||||
|
// $plantId = $rule->plant;
|
||||||
|
|
||||||
switch ($type) {
|
// $command = $schedule->command('send:invoice-report', [$type, $plantId]);
|
||||||
case 'Live':
|
|
||||||
$command->everyMinute();
|
|
||||||
break;
|
|
||||||
case 'Hourly':
|
|
||||||
$command->hourly();
|
|
||||||
break;
|
|
||||||
case 'Daily':
|
|
||||||
$command->dailyAt('07:59');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Invoice report scheduling
|
// switch ($type) {
|
||||||
$invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
// case 'Live':
|
||||||
->select('plant', 'schedule_type')
|
// $command->everyMinute();
|
||||||
->distinct()
|
// break;
|
||||||
->get();
|
// case 'Hourly':
|
||||||
|
// $command->hourly();
|
||||||
|
// break;
|
||||||
|
// case 'Daily':
|
||||||
|
// $command->dailyAt('07:59');
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
foreach ($invoiceRules as $rule) {
|
// // Invoice Data Report Scheduling
|
||||||
$type = $rule->schedule_type;
|
// $invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
|
||||||
$plantId = $rule->plant;
|
// ->select('plant', 'schedule_type')
|
||||||
|
// ->distinct()
|
||||||
|
// ->get();
|
||||||
|
|
||||||
$command = $schedule->command('send:invoice-report', [$type, $plantId]);
|
// foreach ($invoiceDataRules as $rule) {
|
||||||
|
// $type = $rule->schedule_type;
|
||||||
switch ($type) {
|
// $plantId = $rule->plant;
|
||||||
case 'Live':
|
|
||||||
$command->everyMinute();
|
|
||||||
break;
|
|
||||||
case 'Hourly':
|
|
||||||
$command->hourly();
|
|
||||||
break;
|
|
||||||
case 'Daily':
|
|
||||||
$command->dailyAt('07:59');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Invoice Data Report Scheduling
|
|
||||||
$invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
|
|
||||||
->select('plant', 'schedule_type')
|
|
||||||
->distinct()
|
|
||||||
->get();
|
|
||||||
|
|
||||||
foreach ($invoiceDataRules as $rule) {
|
|
||||||
$type = $rule->schedule_type;
|
|
||||||
$plantId = $rule->plant;
|
|
||||||
|
|
||||||
$command = $schedule->command('send:invoice-data-report', [$type, $plantId]);
|
|
||||||
|
|
||||||
switch ($type) {
|
|
||||||
case 'Live':
|
|
||||||
$command->everyMinute();
|
|
||||||
break;
|
|
||||||
case 'Hourly':
|
|
||||||
$command->hourly();
|
|
||||||
break;
|
|
||||||
case 'Daily':
|
|
||||||
$command->dailyAt('10:00');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
// $command = $schedule->command('send:invoice-data-report', [$type, $plantId]);
|
||||||
|
|
||||||
|
// switch ($type) {
|
||||||
|
// case 'Live':
|
||||||
|
// $command->everyMinute();
|
||||||
|
// break;
|
||||||
|
// case 'Hourly':
|
||||||
|
// $command->hourly();
|
||||||
|
// break;
|
||||||
|
// case 'Daily':
|
||||||
|
// $command->dailyAt('10:00');
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|||||||
Reference in New Issue
Block a user