@php use App\Models\Business; use App\Models\MstUser; use App\Models\Notifications; use App\Models\Friend; use App\Models\MstAuthorization; use App\Models\Chats; $chats = Chats::all(); $userDetail=\Auth::user() ?? ""; $userDetail=\Auth::user() ?? ""; if(Auth::User()->userTypeId==1){ $profileImage=$userDetail->getUserDetail->profileImageUrl ?? ""; $userName=$userDetail->getUserDetail->userName ?? ""; $loggedIn=$userDetail->getUserDetail->userId ?? ""; }else{ $profileImage=$userDetail->getBusinessDetail->logoImageUrl ?? ""; $loggedIn=$userDetail->getBusinessDetail->businessId ?? ""; } $profileUrl=env('APPLICATION_URL').$profileImage; $notifications = Notifications ::where('receiverId', $loggedIn)->get(); $getFriendsList = Friend::where('userId', $loggedIn)->get(); $friendDetail = []; $friendNames=[]; $followeId = []; foreach ($getFriendsList as $list) { $followeId[] = $list->followerId; } $checkUserType = MstAuthorization::whereIn('userId', $followeId)->get(); foreach ($checkUserType as $user) { if ($user->userTypeId == 1) { $friendDetail[] = MstUser::where('userId', $user->userId)->get(); } else if ($user->userTypeId == 2) { $friendDetail[] = Business::where('businessId', $user->userId)->get(); } } @endphp