diff --git a/src/Jobs/Assets/Character/Assets.php b/src/Jobs/Assets/Character/Assets.php index de3ec34a..d547b55e 100644 --- a/src/Jobs/Assets/Character/Assets.php +++ b/src/Jobs/Assets/Character/Assets.php @@ -98,22 +98,26 @@ public function handle(): void $assets = collect($response->getBody()); - $assets->each(function ($asset) use ($structure_batch) { - - $model = CharacterAsset::firstOrNew([ - 'item_id' => $asset->item_id, - ]); - - //make sure that the location is loaded if it is in a station or citadel - if (in_array($asset->location_flag, StructureBatch::RESOLVABLE_LOCATION_FLAGS) && in_array($asset->location_type, StructureBatch::RESOLVABLE_LOCATION_TYPES)) { - $structure_batch->addStructure($asset->location_id); - } - - AssetMapping::make($model, $asset, [ - 'character_id' => function () { - return $this->getCharacterId(); - }, - ])->save(); + $assets->chunk(1000)->each(function ($chunk) use ($structure_batch, $start) { + + $chunk->each(function ($asset) use ($structure_batch, $start) { + + $model = CharacterAsset::firstOrNew([ + 'item_id' => $asset->item_id, + ]); + + //make sure that the location is loaded if it is in a station or citadel + if (in_array($asset->location_flag, StructureBatch::RESOLVABLE_LOCATION_FLAGS) && in_array($asset->location_type, StructureBatch::RESOLVABLE_LOCATION_TYPES)) { + $structure_batch->addStructure($asset->location_id); + } + + AssetMapping::make($model, $asset, [ + 'character_id' => function () { + return $this->getCharacterId(); + }, + 'updated_at' => $start, + ])->save(); + }); }); if (! $this->nextPage($response->getPagesCount())) diff --git a/src/Jobs/Assets/Corporation/Assets.php b/src/Jobs/Assets/Corporation/Assets.php index 2b93abca..8a831148 100644 --- a/src/Jobs/Assets/Corporation/Assets.php +++ b/src/Jobs/Assets/Corporation/Assets.php @@ -104,9 +104,9 @@ public function handle() $assets = collect($response->getBody()); - $assets->chunk(1000)->each(function ($chunk) use ($structure_batch) { + $assets->chunk(1000)->each(function ($chunk) use ($structure_batch, $start) { - $chunk->each(function ($asset) use ($structure_batch) { + $chunk->each(function ($asset) use ($structure_batch, $start) { $model = CorporationAsset::firstOrNew([ 'item_id' => $asset->item_id, @@ -121,6 +121,7 @@ public function handle() 'corporation_id' => function () { return $this->getCorporationId(); }, + 'updated_at' => $start, ])->save(); }); });