/** * Show the following list on account profile. * * @param Request $request * @return \Illuminate\Http\Response */ public function following(Request $request) { /* * -------------------------------------------------------------------------- * Populating account following * -------------------------------------------------------------------------- * Retrieve following 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(); $following = $contributor->contributorFollowing(Auth::user()->username); if (Input::get('page', false) && $request->ajax()) { return $following; } else { return view('contributor.following', compact('contributor', 'following')); } }
/** * Display a listing of the contributor following. * * @param $username * @return \Illuminate\Http\Response */ public function following($username) { /* * -------------------------------------------------------------------------- * Populating following * -------------------------------------------------------------------------- * Retrieve following 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); $following = $this->contributor->contributorFollowing($username); if (Input::get('page', false)) { return $following; } else { return view('profile.following', compact('contributor', 'following')); } }
/** * Display a listing of the contributor following. * * @param Request $requests * @param $username * @return \Illuminate\Http\Response */ public function following(Request $requests, $username) { $contributor = $this->contributor->profile($username, false, $requests->get('contributor_id'), true); $following = $this->contributor->contributorFollowing($username, $requests->get('contributor_id'), true); return $this->responseData($contributor, 'following', $following); }