Just upgraded to Laravel 10 and I found that the links in the meta response are not correctly populating with the expected string. I am using this package.
In the Laravel framework there is a class Illuminate\Pagination\LengthAwarePaginator
that has a method link collection:
public function linkCollection()
{
return collect($this->elements())->flatMap(function ($item) {
if (! is_array($item)) {
return [['url' => null, 'label' => '...', 'active' => false]];
}
return collect($item)->map(function ($url, $page) {
return [
'url' => $url,
'label' => (string) $page,
'active' => $this->currentPage() === $page,
];
});
})->prepend([
'url' => $this->previousPageUrl(),
'label' => function_exists('__') ? __('pagination.previous') : 'Previous',
'active' => false,
])->push([
'url' => $this->nextPageUrl(),
'label' => function_exists('__') ? __('pagination.next') : 'Next',
'active' => false,
]);
}
The problem is simple that the function_exists('__')
is returning false and it is causing the label to be 'Previous' or 'Next'. This is a problem because my front end depends on the pagination.previous
and pagination.next
string in order to build the pagination tabs.
Any idea why this might be happening?