Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel pagination bootstrap 5

// Directly in your blade file
$posts->links('pagination::bootstrap-4')
Comment

Laravel Boot strap Pagination

use IlluminatePaginationPaginator;
public function boot()
{
    Paginator::useBootstrap();
Comment

bootstrap pagination laravel

Run
php artisan vendor:publish --tag=laravel-pagination
To show the pagination correctly
Comment

Laravel custom pagination

<?php
// config
$link_limit = 7; // maximum number of links (a little bit inaccurate, but will be ok for now)
?>

@if ($paginator->lastPage() > 1)
    <ul class="pagination">
        <li class="{{ ($paginator->currentPage() == 1) ? ' disabled' : '' }}">
            <a href="{{ $paginator->url(1) }}">First</a>
         </li>
        @for ($i = 1; $i <= $paginator->lastPage(); $i++)
            <?php
            $half_total_links = floor($link_limit / 2);
            $from = $paginator->currentPage() - $half_total_links;
            $to = $paginator->currentPage() + $half_total_links;
            if ($paginator->currentPage() < $half_total_links) {
               $to += $half_total_links - $paginator->currentPage();
            }
            if ($paginator->lastPage() - $paginator->currentPage() < $half_total_links) {
                $from -= $half_total_links - ($paginator->lastPage() - $paginator->currentPage()) - 1;
            }
            ?>
            @if ($from < $i && $i < $to)
                <li class="{{ ($paginator->currentPage() == $i) ? ' active' : '' }}">
                    <a href="{{ $paginator->url($i) }}">{{ $i }}</a>
                </li>
            @endif
        @endfor
        <li class="{{ ($paginator->currentPage() == $paginator->lastPage()) ? ' disabled' : '' }}">
            <a href="{{ $paginator->url($paginator->lastPage()) }}">Last</a>
        </li>
    </ul>
@endif
Comment

PREVIOUS NEXT
Code Example
Php :: twig for 
Php :: laravel upload image to public folder 
Php :: laravel model relationship find soft deleted 
Php :: php strip tags 
Php :: whats the meaninig of void functions in php 
Php :: php string replace space 
Php :: oxygen upload font 
Php :: display rows brought back by query php 
Php :: php in array key 
Php :: create custom domain in localhost xampp 
Php :: link input button in php 
Php :: symfony call another controller 
Php :: customer io send_at api 
Php :: destroy php variable 
Php :: img src php wordpress 
Php :: laravel pass parameter to resource collection 
Php :: take fraction of number in laravel 
Php :: laravel session put method 
Php :: php check credit card expiration 
Php :: laravel export make comman 
Php :: how to add extra days from a date php 
Php :: laravel forelse 
Php :: php find lowest value in associative array 
Php :: php uuid generator 
Php :: codeigniter where_not_in 
Php :: php convert number to month 
Php :: php convert date string to number 
Php :: php make array to certain length 
Php :: php favicon 
Php :: mysql server has gone away php 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =