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

View file

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