Can you show your blade file? :)
Laravel shows two pagination
Hello
I am new in Laravel. Sorry if my question is not match with the quality of this forum.
I add $collection->links() in the blade. Now it shows two pagination.
Any solution how to fix that? Thank you in advanced.
@Sinnbeck Here is my blade page.
<div class="jobs-snippet">
@foreach ($scholarships as $scholarship)
<div class="media media-card media--card align-items-center">
<div class="media-body border-left-0">
<h5 class="pb-1"><a href="{{ $scholarship->link() }}">{{ $scholarship->title }}</a></h5>
<small class="meta d-block lh-20 pb-1">
Provider:
<a href="{{ route('scholarships.show', $scholarship->slug) }}" class="author">{{ $scholarship->provider }}</a>
<span class="px-1">Study In:</span>
<span class="fw-medium">
@foreach ($scholarship->studyInLinks() as $key => $name )
<a href="/countries/{{ $name }}-{{ $key }}">{{ $name }}</a>
@endforeach
</span>
</small>
<small class="meta d-block lh-20">
<span class="pr-1 text-success fw-medium">
Study Level:
@foreach ($scholarship->studyLevelRelationship as $studyLevelRelationship )
<a href="/study-level/{{ $studyLevelRelationship->studyLevel->slug }}-{{ $studyLevelRelationship->studyLevel->id }}">
{{ $studyLevelRelationship->studyLevel->title }}
</a>
@endforeach
</span>
Deadline:
<span class="text-info fw-medium">
{{ $scholarship->expired_at->format('d F Y') }}
</span>
</small>
<div class="tags pt-2">
@foreach ($scholarship->fundingTypes() as $key => $fundingType)
<a href="/scholarship-types/{{ $fundingType }}-{{ $key }}" class="tag-link">{{ $fundingType }}</a>
@endforeach
</div>
</div>
</div><!-- end media -->
@endforeach
</div><!-- end jobs-snippet -->
{{ $scholarships->links() }}
@MahmudLaravel That looks correct. Is there any chance that this is inside a loop?
What happens if you add a test text like this
{{ $scholarships->links() }}
SOME RANDOM TEXT
Is the text shown twice as well?
Make sure:
- You used
pagination()? -
->links()didn't call twice in the blade.
Btw, it would be way easier if you show your code / a screenshot.
@tisuchi Yes, I called pagination().
Here is my controller code-
$scholarships = Scholarship::with([
'countryScholarship.country',
'scholarshipTypeRelationship.scholarshipType',
'studyLevelRelationship.studyLevel',
])
->countryScholarship($this->idExtractor($country))
->paginate(15);
return view('templates.front-end.country-scholarships')
->with([
'title' => $this->titleExtractor($country),
'scholarships' => $scholarships,
]);
and I called links() only once.
@MahmudLaravel Interesting! It seems everything is correct.
But have you tried setting Paginator::useBootstrap(); in app/Providers/AppServiceProvider.php? (Not Tested)
@tisuchi Thank you Sir. Thank you so much. It is working now. :)
Please or to participate in this conversation.