toby
178
2
Laravel

[L5.*] Pagination: Change URL query name "page" globally

Posted 10 months ago by toby

Hi,

almost a year ago, I asked, if it's possible to globally change the name for the page query attribute if you enable pagination: Instead of having a url like tickets?page=23 I wanted to translate this to tickets?seite=23. Therefore, I created a lil' helper function to do so.

I also use the following snippet inside my routes/web.php file to rename the routes from tickets/new to tickets/neu and tickets/23/edit to tickets/23/bearbeiten:

// routes/web.php

Route::resourceVerbs([
    'create' => 'neu',
    'edit' => 'bearbeiten',
]);

Route::resource('tickets', 'TicketController');

I wonder if there is an alternative solution to the ?page=-to-?seite=-problem?

Thanks in advance

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.