No idea why this is needed, but…

This commit is contained in:
snipe 2017-11-03 12:20:11 -07:00
parent 733921f1f9
commit 53a1511cac

View file

@ -31,7 +31,7 @@ class MigrateDenormedAssetLocations extends Migration
$assigned_user_assets = Asset::where('assigned_type',User::class)->whereNotNull('assigned_to')->get(); $assigned_user_assets = Asset::where('assigned_type',User::class)->whereNotNull('assigned_to')->get();
\Log::debug('User-assigned assets:'); \Log::debug('User-assigned assets:');
foreach ($assigned_user_assets as $assigned_user_asset) { foreach ($assigned_user_assets as $assigned_user_asset) {
if ($assigned_user_asset->assignedTo->userLoc) { if (($assigned_user_asset->assignedTo) && ($assigned_user_asset->assignedTo->userLoc)) {
$new_location=$assigned_user_asset->assignedTo->userloc->id; $new_location=$assigned_user_asset->assignedTo->userloc->id;
\Log::info(' They are in '.$assigned_user_asset->assignedTo->userloc->name.' which is id: '.$new_location); \Log::info(' They are in '.$assigned_user_asset->assignedTo->userloc->name.' which is id: '.$new_location);
} else { } else {