S
S
Sergey2021-05-19 23:03:31
Laravel
Sergey, 2021-05-19 23:03:31

How to change pagination in laravel and what does @ mean in code - is it php?

How to change pagination in laravel and what does @ mean in code - is it php?
Now it is displayed in this form and all page numbers are displayed? how to hide leave first 4 and last 4?

@if($news->lastPage() > 1)
                <div class="masonry_footer">
                    <div class="masonry_breadcrumbs">
                        @for($i=1;$i<=$news->lastPage();$i++)
                            <a href="{{route('indexPage', [$i])}}" class="masonry_breadcrumbs_item {{$news->currentPage() == $i ? "active ": ""}}">{{$i}}</a>
                        @endfor
            {{--$users = DB::table('users')->simplePaginate(15);--}}
                        {{[email protected]($news->currentPage() < $news->lastPage())--}}
                        {{--<a href="{{$news->currentPage()+1}}" class="masonry_breadcrumbs_item ico_arrows"></a>--}}
                        {{[email protected]}}
                    </div>
                </div>
            @endif

I don’t know Laravel at all and the code starting with @ (@for($i=1;$i<=$news->lastPage();$i++)) is PHP?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
James026, 2021-05-21
@James026

Easy way {{ $news->onEachSide(4)->links() }}
Second, just like in normal php, take 4 elements from the beginning and from the end and output them

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question