public function isUserExists($conversationId, $userId) { $exists = Conversation::where('id', $conversationId)->where(function ($query) use($userId) { $query->where('user_one', $userId)->orWhere('user_two', $userId); })->exists(); return $exists; }
/** * check the given user exist for the given conversation. * * @param int $conversationId * @param int $userId * @return bool */ public function isAuthenticUser($conversationId, $userId) { if ($conversationId && $userId) { return $this->conversation->isUserExists($conversationId, $userId); } return false; }