table.blade.php

mail@pastecode.io avatar
unknown
php_laravel_blade
2 years ago
3.0 kB
1
Indexable
Never
<div class="col-md-6">
                        @if ($data->links()['paginator']->hasPages())
                            <nav class="d-lg-flex justify-content-lg-end dataTables_paginate paging_simple_numbers">
                                <ul class="pagination">
                                    @if ($data->links()['paginator']->onFirstPage())
                                        <li class="page-item disabled"><a class="page-link" href="#"
                                                aria-label="Previous"><span aria-hidden="true">«</span></a></li>
                                    @else
                                        <li class="page-item"><a class="page-link"
                                                href="{{ $data->links()['paginator']->previousPageUrl() }}"
                                                aria-label="Previous"><span aria-hidden="true">«</span></a></li>
                                    @endif

                                    @foreach ($data->links()['elements'] as $element)
                                        @if (is_string($element))
                                            <li class="page-item active">{{ $element }}</li>
                                        @endif
                                    @endforeach

                                    @if (is_array($element))
                                        @foreach ($element as $page => $url)
                                            @if ($page == $data->currentPage())
                                                <li class="page-item active">
                                                    <a class="page-link" href="#">{{ $page }}</a>
                                                </li>
                                            @else
                                                <li class="page-item">
                                                    <a class="page-link"
                                                        href="{{ $url }}">{{ $page }}</a>
                                                </li>
                                            @endif
                                        @endforeach
                                    @endif

                                    @if ($data->links()['paginator']->hasMorePages())
                                        <li class="page-item"><a class="page-link"
                                                href="{{ $data->links()['paginator']->nextPageUrl() }}"
                                                aria-label="Next"><span aria-hidden="true">»</span></a></li>
                                    @else
                                        <li class="page-item disabled"><span aria-hidden="true"><a href=""
                                                    class="page-link">»</a></span></li>
                                    @endif
                                </ul>
                            </nav>
                        @endif
                    </div>