“Laravel Pagination Kustom” Kode Jawaban

pagination bootstrap khusus laravel

php artisan vendor:publish --tag=laravel-pagination
ashik

Hubungan Paginat Laravel7

$category = Category::first();
$apps = $category->apps()->paginate(10);
return view('example', compact('category', 'apps'));
Zeevx

Laravel Multiple Paginate

# use default 'page' for this
$collection1 = Model::paginate(20);

# use custom 'other_page' for this
$collection2 = Model2::paginate(20);
$collection2->setPageName('other_page');
Frail Fowl

pagination kustom css laravel

php artisan vendor:publish --tag=laravel-pagination
  OR
use Illuminate\Pagination\Paginator;

public function boot()
{
    Paginator::defaultView('your-pagination-view-name');

}
@marlino

Masalah tata letak pagination laravel

/**
 * AppServiceProvider.php
 */

use Illuminate\Pagination\Paginator; // Don't forget this

public function boot ()
{
      Paginator::useBootstrap();	// Add this
}
Beautiful Bee

Laravel Pagination Kustom

<?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
Friendly Ferret

Jawaban yang mirip dengan “Laravel Pagination Kustom”

Pertanyaan yang mirip dengan “Laravel Pagination Kustom”

Lebih banyak jawaban terkait untuk “Laravel Pagination Kustom” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya