10 months ago

can't paginate search result records?

Posted 10 months ago by nhayder

this is the form

<form action="{{route('rp')}}" method="GET" role="search" enctype="multipart/form-data">
    <input type="text" name="search" class="search-input form-control" placeholder="@lang('translation.search')" required="true"/>


and i have this route to execute the search

Route::get('/rp', '[email protected]')->name('rp');

in my controller

    public function resultPage(Request $request)


            'search' => 'required|string|min:3',


        $query = User::query();

        $columns = ['firstname','familyname', 'email', 'language', 'adminnote','gender','address1','address2','company','city','postalcode','phone'];

        foreach($columns as $column){

            $query->orWhere($column, 'LIKE', '%' . $request->search . '%');

        $results = $query->paginate(25);

        return view('admin.search', compact('results'));

at the same time i'm using links() function to paginate results

@foreach($results as $user)
    // do something


{{ $results->links() }}

this is what i'm getting on the browser when submitting search from

when hover over the pagination button i'm getting these // and page=3 + 5 + 10  etc

the problem is that pationation is not working it basically stays on same page even after i click the next button

what seems to be the problem


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