/** * 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); }
/** * Display a listing of the resource. * @param Request $request * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(Request $request) { $pagiData = $this->news->paginate($request->get('page', 1), $this->perPage, false); $news = Pagination::makeLengthAware($pagiData->items, $pagiData->totalItems, $this->perPage); return view('frontend.news.index', compact('news')); }