I am new to the Laravel Search functionality and pagination. I am using Laravel 5.6 and have search functionality.

Controller Code

```
public function search()
    {
    $users = User::whereRole_id(1)->where(function($query) {
                $q = Input::get ( 'q' );
                return $query->where ( 'name', 'LIKE', '%' . $q . '%' )->orWhere ( 'email', 'LIKE', '%' . $q . '%' )->orWhere ( 'phone', 'LIKE', '%' . $q . '%');
        })->paginate(8)->setPath('');
        $pagination = $users->appends ( array ('q' => Input::get ( 'q' ) ) );
                if (count($users) > 0){
                    return view( 'admin.users.index',compact('users'));
                }else{
                    $q = Input::get ( 'q' );
                    Session::flash('Nosearch',"No Details found with $q .Try to search again !");
                    return view( 'admin.users.index',compact('users'));
            }
    }

```

My View Code:

I am using {{$users->links()}} to display the links and when I do view source code it is giving correct param as well as page numbers like this:

```
<li class="page-item active" aria-current="page"><span class="page-link">1</span</li><li class="page-item"><a class="page-link" href="?q=abc&amp;page=2">2</a></li>

```

Route Code:

```
Route::group([
    'as'=>'admin.',
    'prefix' => 'admin',
    'middleware' => 'admin'
], function() {
    Route::post('/users/search', 'AdminUsersController@search');
}

```

When I click on next page it gives me error as below
[Page Not Found Error](https://i.stack.imgur.com/qdscj.png)

Kindly, help me where am I going wrong please? Thanks, Palak