Skip to content

A free open source IT asset/license management system

Check for asset before attempting to cite mismatch

snipe25b8c4438e80
diff --git a/database/migrations/2017_10_27_192423_migrate_denormed_asset_locations.php b/database/migrations/2017_10_27_192423_migrate_denormed_asset_locations.php
index 45d5668a38..0d9f2c8cfd 100644
--- a/database/migrations/2017_10_27_192423_migrate_denormed_asset_locations.php
+++ b/database/migrations/2017_10_27_192423_migrate_denormed_asset_locations.php
@@ -67,15 +67,16 @@ class MigrateDenormedAssetLocations extends Migration
$unassigned_assets=Asset::whereNull("location_id")->get();
foreach($unassigned_assets as $unassigned_asset) {
- \Log::info('Asset: ".$unassigned_asset->id." still has no location');
+ \Log::info('Asset: '.$unassigned_asset->id.' still has no location');
}
- Asset::all()->each(function ($asset) {
- if($asset->location_id != $asset->assetLoc()->id) {
- \Log::info('MISMATCH MISMATCH '.$asset->id. "doesn't match its location");
+ Asset::get()->each(function ($asset) {
+ if (($asset) && ($asset->location_id != $asset->assetLoc()->id)) {
+ \Log::info('MISMATCH MISMATCH '.$asset->id. "doesn't match its location");
}
});
-
+
+ die();
}
/**