nikankad's avatar

how to make a pagination where the link options are the number of items you want to show

is there anyway i can do this with pagination or do i need to use sql?

this is what i mean:https://imgur.com/a/nkpKfWp

0 likes
4 replies
Cronix's avatar

The paginate() method takes a parameter for the number of entries to show per page. Given that, you could just have a drop down form that has 5, 10, 20, etc as values and use that value to get the number of entries.

<select name="perPage">
    <option value="5">5</option>
    <option value="10">10</option>
</select>
$perPage = $request->input('perPage', 10);

$users = App\User::paginate($perPage);

The above will use the value from perPage, or default to 10 if not present.

Snapey's avatar

no, since this is a Get request, all parameters must be in the url

Please or to participate in this conversation.