mardi 25 août 2015

laravel 5 custom paginator not displaying page navigation links in view

im trying to implement a view like sphinx documentation where you can click on next and previous to navigate between pages. not sure if im using the custom paginator right, i cant get page navigation links to display on a view page. this is the code:

   public function paginate($array, $perPage, $pageStart=1) {

    $offset = ($pageStart * $perPage) - $perPage;

    return new Paginator(array_slice($array, $offset, $perPage, true), $perPage, $pageStart);
   }

   view()->composer('layouts.book', function($view)
   {
        //some other code
        $pages = [];
        foreach($book->textsection_pages as $textsection) {
            $pages[] = $textsection->alias;
        }
        foreach($book->task_pages as $task) {
            $pages[] = $task->alias;
        }
        foreach($book->tutor_pages as $tutor) {
            $pages[] = $tutor->alias;
        }
        foreach($book->eval_pages as $eval) {
            $pages[] = $eval->alias;
        }

        $chapters = $book->chapters()->orderBy('weight', 'asc')->get();
        $paginated = $this->paginate($pages, 1);
        $view->with(['chapters' => $chapters, 'book' => $book, 'paginated' => $paginated]);

    });

and in the view i called {!! $paginated->render() !!}, but no navigation link is displayed.

also, should $pageStart always be 1? if no, how to get the value of it?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1KhKvvL
via IFTTT

Aucun commentaire:

Enregistrer un commentaire