/** * Display the specified contributor stream or profile. * * @param $username * @return \Illuminate\Http\Response */ public function show($username) { /* * -------------------------------------------------------------------------- * Populating stream * -------------------------------------------------------------------------- * Retrieve stream article 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); $stream = $this->contributor->stream($username); if (Input::get('page', false)) { return $stream; } else { return view('profile.stream', compact('contributor', 'stream')); } }
/** * Display the specified contributor stream. * * @param Request $requests * @param $username * @return \Illuminate\Http\Response */ public function stream(Request $requests, $username) { $contributor = $this->contributor->profile($username, false, $requests->get('contributor_id')); $stream = $this->contributor->stream($username); return $this->responseData($contributor, 'articles', $stream); }
/** * Display a listing of the account article. * * @param Request $request * @return \Illuminate\Http\Response */ public function stream(Request $request) { /* * -------------------------------------------------------------------------- * Stream on the fly * -------------------------------------------------------------------------- * Retrieve authenticate contributor stream, this page implement lazy * pagination then return json if page variable exists, return view if it * does not. */ $contributor = new Contributor(); $stream = $contributor->stream(Auth::user()->username); if (Input::get('page', false) && $request->ajax()) { return $stream; } else { return view('contributor.stream', compact('stream')); } }