- New migrations: ticket views, statuses, participants, merge support - New models: TicketView, TicketStatus, TicketParticipant - New seeder: EmailTemplatesSeeder - Console commands for ticketing - Mobile: sidebar min-w-0/overflow-hidden, tab nav overflow-x-auto Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
34 lines
929 B
PHP
34 lines
929 B
PHP
<?php
|
|
|
|
namespace Dashboard\Ticketing\Console\Commands;
|
|
|
|
use App\Models\Setting;
|
|
use Dashboard\Ticketing\Models\Ticket;
|
|
use Illuminate\Console\Command;
|
|
|
|
class AutoCloseTickets extends Command
|
|
{
|
|
protected $signature = 'ticketing:auto-close';
|
|
protected $description = 'Close resolved tickets that have not been updated within the configured grace period.';
|
|
|
|
public function handle(): int
|
|
{
|
|
$days = (int) Setting::get('ticketing.auto_close_days', 0);
|
|
|
|
if ($days <= 0) {
|
|
$this->info('Auto-close is disabled (ticketing.auto_close_days = 0).');
|
|
return 0;
|
|
}
|
|
|
|
$cutoff = now()->subDays($days);
|
|
|
|
$count = Ticket::where('status', 'resolved')
|
|
->where('updated_at', '<=', $cutoff)
|
|
->update(['status' => 'closed']);
|
|
|
|
$this->info("Auto-closed {$count} ticket(s) resolved more than {$days} day(s) ago.");
|
|
|
|
return 0;
|
|
}
|
|
}
|