public function followersFollow() { $requestFollower = Request::all(); $newFollower = new Follower(); $newFollower->user_id = $requestFollower['user_id']; $newFollower->follow_id = $requestFollower['follow_id']; $newFollower->save(); return 'Success'; }
/** * Follow Artist * * @return View */ public function Follow(Request $request) { if (!$request->ajax()) { dd("NO ASYNC REQUEST"); } $res = array(); $res['success'] = false; $user = Auth::user(); $whom = User::find($request->input('id')); if ($whom) { $followY = Follower::where('user_id', $whom->id)->where('follower_id', $user->id)->first(); if ($followY) { $followY->delete(); $res['success'] = true; $res['message'] = "Follow"; //tell to follow } else { $follow = new Follower(); $follow->user_id = $whom->id; $follow->follower_id = $user->id; $follow->save(); $res['success'] = true; $res['message'] = "Unfollow"; //tell to unfollow } } return $res; }