From c551bcafeb08e95bfd152d479b389e7ea686484d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Sat, 6 May 2023 10:16:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20SQL=20=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=20N+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/DeviceLogSyncCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/DeviceLogSyncCommand.php b/app/Console/Commands/DeviceLogSyncCommand.php index 51df568..e727132 100644 --- a/app/Console/Commands/DeviceLogSyncCommand.php +++ b/app/Console/Commands/DeviceLogSyncCommand.php @@ -60,7 +60,7 @@ class DeviceLogSyncCommand extends Command protected function performSync(Carbon $start, Carbon $end): void { /** @var \Illuminate\Database\Eloquent\Collection */ - $devices = Device::poweredBy($this->argument('factory'))->get(); + $devices = Device::with(['factory'])->poweredBy($this->argument('factory'))->get(); foreach ($devices as $device) { $this->info('==========================================');