Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rid3638's avatar

Pagination is not working on laravel 11

I am using laravel 11. This is my code:

        $scholarships = Scholarship::with([
            'creator',
            'fundingTypes',
            'providers',
            'subjects',
            'countries',
            'educationLevels',
        ])
            ->latest()
            ->paginate(10)
            ->withQueryString();

This is how I show the pagination:

    {{ $scholarships->links() }}

Any idea why?

0 likes
4 replies
tisuchi's avatar

@rid3638 Did you pass the $scholarships to the view properly? I mean, can you access the $scholarships from the view page?

2 likes
tisuchi's avatar
tisuchi
Best Answer
Level 70

@rid3638 It seems there is no issue with your code.

Maybe you can clear the cache:

 php artisan route:clear && php artisan view:clear && php artisan cache:clear

⚠️ And double confirm that you have enough records. As you mentioned that, ->paginate(10) which means if you have less than 10 records, you may don't see the pagination* link.

2 likes
rid3638's avatar

@tisuchi I see. it was because I don't have less than 10 entries. Thank you very much sir.

2 likes

Please or to participate in this conversation.