修复 SQL 查询 N+1
parent
4646f1fd16
commit
c551bcafeb
|
|
@ -60,7 +60,7 @@ class DeviceLogSyncCommand extends Command
|
||||||
protected function performSync(Carbon $start, Carbon $end): void
|
protected function performSync(Carbon $start, Carbon $end): void
|
||||||
{
|
{
|
||||||
/** @var \Illuminate\Database\Eloquent\Collection */
|
/** @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) {
|
foreach ($devices as $device) {
|
||||||
$this->info('==========================================');
|
$this->info('==========================================');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue