public function getSort() { $sort = Request::segment(3); if (Input::get('contname')) { $contname = Input::get('contname'); } $donation = new Donations(); switch ($sort) { case 'top': $result = $donation->getTopContributorsAll(); $totalpages = $result->getLastPage(); break; case 'byname': $result = $donation->getContributorsByname($contname); $totalpages = $result->getLastPage(); break; default: # code... break; } return View::make('landing.bodycontributor')->with(array('data' => $result, 'totalpages' => $totalpages)); }