Q: Laravel Pagination + Livewire: How to retain number of data per page Wanted to get an idea on how to perform this task or my question.
I wanted to have a datatable where it retains the number of data per page and doesn't move data whenever there's changes.
Let's say I got 50 per page then I deleted two data on the first page which makes it 48. I clicked on page 2, the original first 2 data of page 2 was moved to the first page because of what I've deleted. What I wanted is that it shouldn't move and should stay on page 2. Then if I click on other pages, it should still retain first page 48, second page 50.
Hope you get my question.
Thank you in advance. :)

A: I don't know if it's possible to achieve that result, I wouldn't know how. But I suggest as a workaround that you set a property on each item, and then hide or show the item according to that property. This way the pagination counter remains the same.
In your controller:
$my_query_results = $query->paginate(50);

$my_query_results->each(function ($item) {
    $item->visible = true||false; //check a condition here
});

