chore: code refactor via rector

This commit is contained in:
idevakk
2025-11-14 02:01:01 -08:00
parent 90ab79b3a2
commit ae795880ed
148 changed files with 1520 additions and 1486 deletions

View File

@@ -2,7 +2,6 @@
namespace App\Models;
use Carbon\Carbon;
use Exception;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@@ -20,7 +19,7 @@ class Ticket extends Model
{
parent::boot();
static::creating(function ($ticket) {
static::creating(function ($ticket): void {
if (empty($ticket->ticket_id)) {
$ticket->ticket_id = 'TICKET-'.strtoupper(Str::random(6));
}
@@ -46,7 +45,7 @@ class Ticket extends Model
public static function autoClose(): bool
{
try {
$tickets = Ticket::where('status', 'pending')
$tickets = Ticket::query()->where('status', 'pending')
->where('last_response_at', '<', now()->subDays(3))
->get();
if (count($tickets) > 0) {
@@ -54,7 +53,7 @@ class Ticket extends Model
$ticket->status = 'closed';
$ticket->save();
TicketResponse::create([
TicketResponse::query()->create([
'ticket_id' => $ticket->id,
'user_id' => 1,
'response' => 'This ticket has been auto-closed due to inactivity.',
@@ -63,7 +62,7 @@ class Ticket extends Model
}
return true;
} catch (Exception $e) {
} catch (Exception) {
return false;
}