فهرست منبع

Update ProfileController, show follow request on private profiles

Daniel Supernault 6 سال پیش
والد
کامیت
3603913f2a
1فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 6 1
      app/Http/Controllers/ProfileController.php

+ 6 - 1
app/Http/Controllers/ProfileController.php

@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
 use Auth;
 use Cache;
 use App\Follower;
+use App\FollowRequest;
 use App\Profile;
 use App\User;
 use App\UserFilter;
@@ -67,8 +68,12 @@ class ProfileController extends Controller
         $is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
 
         if ($isPrivate == true || $isBlocked == true) {
-            return view('profile.private', compact('user', 'is_following'));
+            $requested = Auth::check() ? FollowRequest::whereFollowerId(Auth::user()->profile_id)
+                ->whereFollowingId($user->id)
+                ->exists() : false;
+            return view('profile.private', compact('user', 'is_following', 'requested'));
         } 
+
         $is_admin = is_null($user->domain) ? $user->user->is_admin : false;
         $profile = $user;
         $settings = [