Hi,
Is there a way to check for the first item of each page when navigating through pagination?
Appreciate the help!
Hi,
Is there a way to check for the first item of each page when navigating through pagination?
Appreciate the help!
Something like that? $pagination->isFirstPage()
Not exactly, that checks if it’s the first page. I’m trying to check for the first item of each page.
Hmm, you need to check in collection like following:
$posts = $page->children()->paginate(10);
foreach($posts as $post)
if ($posts->first()->is($post)) {
// This is first page
}
if ($posts->last()->is($post)) {
// This is last page
}
}
Awesome! That works