/** * Display a listing of the random article. * * @param Request $request * @return \Illuminate\Http\Response */ public function random(Request $request) { /* * -------------------------------------------------------------------------- * Public random article * -------------------------------------------------------------------------- * Random article with SQL order function through article model, this page * implement lazy pagination then return json if page variable exists, * return view if it does not. */ $trending = $this->article->random(); $breadcrumb = ['Archive' => route('article.archive'), 'Random' => route('article.random')]; $next_ref = '#'; $prev_ref = route('article.trending'); if (Input::get('page', false) && $request->ajax()) { return $trending; } else { return view('article.category', compact('breadcrumb', 'next_ref', 'prev_ref')); } }