4.2

Sample AjaxPresenter.php used with improved code.

<?php


class AjaxPresenter extends Illuminate\Pagination\Presenter {

    /**
     * Get HTML wrapper for a page link.
     *
     * @param  string  $url
     * @param  int  $page
     * @param  string  $rel
     * @return string
     */
    public function getPageLinkWrapper($url, $page, $rel = null, $goto)
    {
        $rel = is_null($rel) ? '' : ' rel="'.$rel.'"';
        // MODEL needs to be replaced on front end with the Model Object Name that is calling the paginator
        return '<li><a href="#"'.$rel.' onclick="MODEL.gotoPage('.$goto.');">'.$page.'</a></li>';
    }

    /**
     * Get HTML wrapper for disabled text.
     *
     * @param  string  $text
     * @return string
     */
    public function getDisabledTextWrapper($text)
    {
        return '<li class="disabled"><span>'.$text.'</span></li>';
    }

    /**
     * Get HTML wrapper for active text.
     *
     * @param  string  $text
     * @return string
     */
    public function getActivePageWrapper($text)
    {
        return '<li class="active"><span>'.$text.'</span></li>';
    }

}