/** * Show the follower list on account profile. * * @param Request $request * @return \Illuminate\Http\Response */ public function follower(Request $request) { /* * -------------------------------------------------------------------------- * Populating account followers * -------------------------------------------------------------------------- * Retrieve followers 10 data per request, because we implement lazy * pagination via ajax so return json data when 'page' variable exist, and * return view if doesn't. */ $contributor = new Contributor(); $followers = $contributor->contributorFollower(Auth::user()->username); if (Input::get('page', false) && $request->ajax()) { return $followers; } else { return view('contributor.follower', compact('followers')); } }
/** * Display a listing of the contributor followers. * * @param $username * @return \Illuminate\Http\Response */ public function follower($username) { /* * -------------------------------------------------------------------------- * Populating followers * -------------------------------------------------------------------------- * Retrieve followers 10 data per request, because we implement lazy * pagination via ajax so return json data when 'page' variable exist, and * return view if doesn't. */ $contributor = $this->contributor->profile($username, true); $followers = $this->contributor->contributorFollower($username); if (Input::get('page', false)) { return $followers; } else { return view('profile.follower', compact('contributor', 'followers')); } }
/** * Display a listing of the contributor follower. * * @param Request $requests * @param $username * @return \Illuminate\Http\Response */ public function follower(Request $requests, $username) { $contributor = $this->contributor->profile($username, false, $requests->get('contributor_id'), true); $followers = $this->contributor->contributorFollower($username, $requests->get('contributor_id'), true); return $this->responseData($contributor, 'followers', $followers); }