public function _list($page = 1, $searchString = null) { if (!empty($searchString)) { $klijenti = Klijent::where('ime', 'like', '%' . $searchString . '%')->orderBy('ime'); } else { $klijenti = Klijent::orderBy('ime'); } if ($page != 1) { Paginator::setCurrentPage($page); } $klijenti = $klijenti->paginate(10); $v = View::make('Klijent.list')->with('klijenti', $klijenti); if (Request::ajax()) { return $v->renderSections()['list']; } return $v; }