How to create custom pagination link?

Right now i have this link on paginate :

and what i want is this: and so on

Right now i have this:

{!! $properties->appends(['toggle' => Request::get('toggle'), 'search' => Request::get('search')])->render() !!}

How can i change this to have route like this what i want?

i found this:

Route::get('users', function () {
    $users = AppUser::paginate(15);



But problem is that i use one function for multiple stuff so i can not set path in controller.


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You can keep your existing query like this. you can define one function in your controller

public function getExistingQueryParams()
    $existingQueryParams = [];

    foreach (request()->all() as $key => $value)
        if ($key != 'page')
            $existingQueryParams[$key] = urldecode($value);

    return $existingQueryParams;

In your controller’s function which is returning the view call this function.
$existingQuery = $this->getExistingQueryParams();

Pass this variable in your view and in your view you can use it like this
{{ $propertiers->appends($existingQuery)->links() }}

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x