From e4e7b5062a7894fb73a77284300ddbad274ad5ca Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 21 Jan 2023 08:49:51 -0700 Subject: [PATCH] Update FixDuplicateProfiles command --- app/Console/Commands/FixDuplicateProfiles.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/FixDuplicateProfiles.php b/app/Console/Commands/FixDuplicateProfiles.php index 20ee720e1..de70b925b 100644 --- a/app/Console/Commands/FixDuplicateProfiles.php +++ b/app/Console/Commands/FixDuplicateProfiles.php @@ -155,8 +155,20 @@ class FixDuplicateProfiles extends Command protected function checkFollowers($id, $oid) { - Follower::whereProfileId($oid)->where('profile_id', '!=', $id)->update(['profile_id' => $id]); - Follower::whereFollowingId($oid)->where('following_id', '!=', $id)->update(['following_id' => $id]); + $f = Follower::whereProfileId($oid)->pluck('following_id'); + foreach($f as $fo) { + Follower::updateOrCreate([ + 'profile_id' => $id, + 'following_id' => $fo + ]); + } + $f = Follower::whereFollowingId($oid)->pluck('profile_id'); + foreach($f as $fo) { + Follower::updateOrCreate([ + 'profile_id' => $fo, + 'following_id' => $id + ]); + } } protected function checkHashtagFollow($id, $oid)