dimanche 28 février 2016

how to set an argument to url in Laravel5 pagination5?

I'm create a pagination using laravel5 as this url http://ift.tt/21ur8cO But I want to set a segment to that url with laravel pagination

http://ift.tt/1QFNKeZ Is it possible in Laravel?

Existing code they used

@include('partials.pagination',['results'=>$data])

This is that pagination

<?php
    $num_display = 7;
    $page  = $results->currentPage();
    $last  = $results->lastPage();
    $start = ( ($page - $num_display ) > 0 ) ? $page - $num_display : 1;
    $end   = ( ( $page + $num_display ) < $last ) ? $page + $num_display : $last;

    if($last > 1){
        $html  = '<ul class="pagination pagination-sm pull-right">';
        $class = ( $page == 1 ) ? "disabled" : "";
        $html .= '<li class="' . $class . '"><a href="' .$results->url( $page - 1 ) . '">&laquo;</a></li>';

        if ( $start > 1 ) {
            $html .= '<li><a href="'.$results->url(1).'">1</a></li>';
            $html .= '<li class="disabled"><span>...</span></li>';
        }

        for ( $i = $start ; $i <= $end; $i++ ) {
            $class = ( $page == $i ) ? "active" : "";
            $html .= '<li class="' . $class . '"><a href="'. $results->url($i) . '">' . $i . '</a></li>';
        }

        if ( $end < $last ) {
            $html .= '<li class="disabled"><span>...</span></li>';
            $html .= '<li><a href="' .$results->url($last) . '">' . $last . '</a></li>';
        }

        $class = ( $page == $last ) ? "disabled" : "";
        $html .= '<li class="' . $class . '"><a href="' . $results->url( $page + 1 ) . '">&raquo;</a></li>';
        $html .= '</ul>';
        echo $html;
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire