senderIMAccount)->first(); $receiveUser = UserModel::where('im_account', $event->receiverIMAccount)->first(); if ($sendUser && $receiveUser) { FriendContact::updateOrCreate([ 'uid' => $sendUser->uid, 'friend_uid' => $receiveUser->uid ], [ 'list_unread_msg_cnt' => DB::raw("`list_unread_msg_cnt` + 1"), 'last_at' => $event->timestamp, 'last_msg' => $event->contentArray ]); FriendContact::updateOrCreate([ 'uid' => $receiveUser->uid, 'friend_uid' => $sendUser->uid ], [ 'list_unread_msg_cnt' => DB::raw("`list_unread_msg_cnt` + 1"), 'last_at' => $event->timestamp, 'last_msg' => $event->contentArray ]); } } }