Files
Investidor-V2/app/Console/Commands/EscalateOverdueInvestmentTasks.php
T
nala 4f35313d06
tests / ci (push) Canceled after 0s
novas funcionalidades dos formulario
2026-10-02 11:13:37 +02:00

31 lines
999 B
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class EscalateOverdueInvestmentTasks extends Command
{
protected $signature = 'investmoz:escalate-overdue-tasks';
protected $description = 'Eleva a prioridade de tarefas operacionais vencidas, quando activado.';
public function handle(): int
{
if (! config('existing-business.sla_escalation_enabled')) {
$this->components->info('Escalada SLA desactivada.');
return self::SUCCESS;
}
$count = DB::table('tasks')->whereIn('task_type', ['triage', 'interest_follow_up'])
->whereIn('status', ['open', 'in_progress'])->whereNotNull('due_at')->where('due_at', '<', now())
->where('priority', '>', 1)->update(['priority' => 1, 'outcome' => 'sla_overdue', 'updated_at' => now()]);
$this->components->info("Tarefas elevadas para prioridade máxima: {$count}.");
return self::SUCCESS;
}
}