location_id = $target->id; Asset::where('assigned_type', 'App\Models\Asset')->where('assigned_to', $asset->id) ->update(['location_id' => $asset->location_id]); break; case 'asset': $asset->location_id = $target->rtd_location_id; // Override with the asset's location_id if it has one if ($target->location_id != '') { $asset->location_id = $target->location_id; } break; case 'user': $asset->location_id = $target->location_id; break; } return $asset; } }