/** * Display a listing of the resource. * * @return Response */ public function index() { //$news = $this->news->paginate(); $page = Input::get('page', 1); $perPage = 5; $pagiData = $this->news->paginate($page, $perPage, false); $news = new LengthAwarePaginator($pagiData->items, $pagiData->totalItems, $perPage, ['path' => Paginator::resolveCurrentPath()]); $news->setPath(""); return view('frontend.news.index', compact('news')); }
/** * @param null $perPage * @param bool $all * @return mixed */ public function paginate($page = 1, $limit = 10, $all = false) { return $this->news->paginate($page, $limit, $all); }