BunsinNANH's avatar

Laravel 7 pagination display blank next pages after filter

When filtering the data it has been returned well with paginate but when clicking the next pages it returned blank pages.

My controller function

public function filter(Request $request) {

    $cat_id = $request->input('cat_id');
    $categories = Category::where('cat_id','LIKE','%'.$cat_id .'%')->paginate(10);

    return view('myview', compact('categories'));


}
0 likes
15 replies
siangboon's avatar

the code above did not seem so....

show your code with appends()...

BunsinNANH's avatar

here public function filter(Request $request) {

$cat_id = $request->input('cat_id');
$categories = Category::where('cat_id','LIKE','%'.$cat_id .'%')->paginate(10);
$pagination = $categories->appends(array('cat_id' => $cat_id));
return view('myview', compact('categories'));

}

Snapey's avatar

unlikely to be related, but you should fix your webserver

You should not see public in the url - it should be the root folder. You will continue to have strange issues until you fix this.

Do you still have issues if you run php artisan serve and then access the url it gives you?

BunsinNANH's avatar

Yes, it still errors when I click to go to the next pages.

BunsinNANH's avatar

I ready installed the Laravel Telescope package but when it scanning too slow not show anything it just scanning.

BunsinNANH's avatar

all both above it working but what my problem is with pagination. The data retrieve as normally but the pagination is not working for the next pages.

Please or to participate in this conversation.