From 4ba58b25468575edbdf4cd378c50736487644046 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Thu, 3 Apr 2025 13:10:45 -0700 Subject: [PATCH] Constrain query --- .../FixBulkAccessoryCheckinActionLogEntries.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/FixBulkAccessoryCheckinActionLogEntries.php b/app/Console/Commands/FixBulkAccessoryCheckinActionLogEntries.php index 8879430c6..47a258608 100644 --- a/app/Console/Commands/FixBulkAccessoryCheckinActionLogEntries.php +++ b/app/Console/Commands/FixBulkAccessoryCheckinActionLogEntries.php @@ -2,6 +2,7 @@ namespace App\Console\Commands; +use App\Models\Accessory; use App\Models\Actionlog; use Illuminate\Console\Command; use Illuminate\Database\Eloquent\Model; @@ -38,8 +39,14 @@ class FixBulkAccessoryCheckinActionLogEntries extends Command $this->newLine(); } - // Logs that were improperly timestamped should have created_at in the 1970s - $logs = Actionlog::whereYear('created_at', '1970')->get(); + $logs = Actionlog::query() + // only look for accessory checkin logs + ->where('item_type', Accessory::class) + // that were part of a bulk checkin + ->where('note', 'Bulk checkin items') + // logs that were improperly timestamped should have created_at in the 1970s + ->whereYear('created_at', '1970') + ->get(); if ($logs->isEmpty()) { $this->info('No logs found with incorrect timestamps.');