Problems with Controller args

Hello everybody.
I really searched a lot for this, but unfortunately I wasn’t able to find solution.

I have really simple controller


return function($site, $pages, $page, $args) {

$articles = $page->children()->children()->children();

if(r::is('POST') && $data = get()) {
    if(isset($data['order'])) {
        $articles = $articles->sortBy('price', $data['order']);

$articles = $articles->paginate(20);
$pagination = $articles->pagination();
return compact('articles','pagination', 'data', 'args');

but if I go to some other page in pagination, my filter resets.

If you can just point me to some docs where can I see how to use args.

Thanks in advance

The problem is that the data you send via POST is not perpetuated when you open a new page (i.e. the condition if(r::is('POST') will no longer be true. Two options to solve this

  1. Quick and easy

    Change the form method from POST to GET and also where you check for a POST request in the controller

  2. A bit more effort

    Keep the POST request, but perpetuate the POST data in a session cookie

I don’t know what you are doing with the $args variable, that is only relevant you are getting data from a route.