Update FollowerController

This commit is contained in:
Daniel Supernault 2018-09-02 22:00:31 -06:00
parent 9b501e9c59
commit 38d6d58dc8
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 4 additions and 4 deletions

View File

@ -34,10 +34,10 @@ class FollowerController extends Controller
$isFollowing = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->count(); $isFollowing = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->count();
if($private == true && $isFollowing == 0) { if($private == true && $isFollowing == 0) {
$follow = new FollowRequest; $follow = FollowRequest::firstOrCreate([
$follow->follower_id = $user->id; 'follower_id' => $user->id,
$follow->following_id = $target->id; 'following_id' => $target->id
$follow->save(); ]);
} elseif ($isFollowing == 0) { } elseif ($isFollowing == 0) {
$follower = new Follower(); $follower = new Follower();
$follower->profile_id = $user->id; $follower->profile_id = $user->id;