I want to see the characters "Next" and "Prev" in Ravel 5.0's Pagination.

Asked 2 years ago, Updated 2 years ago, 56 views

When we do the pagination in Ravel 5.0, we try to link the page with the letters "Next" and "Prev" without displaying the page number.
Normally, you would use simplePaginate(), but render() displays only the string symbol (&lacquo;<raquo;), and there are no characters.

Looking at the language file resources/lang/en/pagination.php, there was a description like 'previous'=>'&lacquo;Previous', but there is no change in rewriting.

The getPreviousButton() argument in the vendor folder in SimpleBootstrapThreePresenter.php seems to replace this character. Do I need to create a custom class to replace it myself?

php laravel

2022-09-30 20:56

2 Answers

You don't seem to have a mechanism in SimpleBootstrapThreePresenter that allows you to value the $this->getPreviousButton() and $this->getNextButton(), so you'll need to create a custom class to replace it yourself.

You can inherit SimpleBootstrapThreePresenter, override the render, and pass values to $this->getPreviousButton() and $this->getNextButton().

public function render()
{
    if($this->hasPages())
    {
        return sprintf(
            '<ul class="pager">%s%s</ul>',
            $this->getPreviousButton(trans('pagination.previous')),
            $this->getNextButton(trans('pagination.next'))
        );
    }
    return '';
}


2022-09-30 20:56

in config/app.php
'locale'=>'ja'


if you have set it to
Create a ja directory in resources/lang and include
pagination.php

<?php

return [

    'previous' = > '&laquo;forward',
    'next' = > 'Next & raquo;',

];

If you install it like that, it will work.


2022-09-30 20:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.