diff --git a/app/Jobs/ProcessAssetsJob.php b/app/Jobs/ProcessAssetsJob.php index f4ea111c6..4db48a19c 100644 --- a/app/Jobs/ProcessAssetsJob.php +++ b/app/Jobs/ProcessAssetsJob.php @@ -89,7 +89,7 @@ class ProcessAssetsJob implements ShouldQueue foreach($assets as $asset) { //If the asset is in one of the locations we want, then store //or update the asset - if(in_array($asset->location_flag, $this->location_array)) { + if(in_array($this->location_array, $asset->location_flag)) { //Attempt to store the asset $aHelper->StoreNewAsset($asset); } diff --git a/app/Library/Assets/AssetHelper.php b/app/Library/Assets/AssetHelper.php index 7a60e3f3c..0e2a2094b 100644 --- a/app/Library/Assets/AssetHelper.php +++ b/app/Library/Assets/AssetHelper.php @@ -134,23 +134,18 @@ class AssetHelper { * Update an existing asset based off the esi pull */ private function UpdateAsset($asset) { - $count = Asset::where([ - 'item_id' => $asset->item_id, - ])->count(); - if($count != 0) { - Asset::where([ - 'item_id' => $asset->item_id, - ])->update([ - 'is_singleton' => $asset->is_singleton, - 'location_flag' => $asset->location_flag, - 'location_id' => $asset->location_id, - 'location_type' => $asset->location_type, - 'quantity' => $asset->quantity, - 'type_id' => $asset->type_id, - 'updated_at' => Carbon::now(), - ]); - } + Asset::where([ + 'item_id' => $asset->item_id, + ])->update([ + 'is_singleton' => $asset->is_singleton, + 'location_flag' => $asset->location_flag, + 'location_id' => $asset->location_id, + 'location_type' => $asset->location_type, + 'quantity' => $asset->quantity, + 'type_id' => $asset->type_id, + 'updated_at' => Carbon::now(), + ]); } }