mancoeg's avatar

filter data with pagination in laravel 5.4.36

i send an array with my keywords to appends() method and it works fine but it fails when click any other page in pagination links.

error: DecryptException the payload is invalid.

Any suggestion

CONTROLLER

    $leads = new Lead;
    $queries = [];
    
    $columns = [
        'state_id', 'assigned_to'
    ];

    foreach($columns as $column){
        if(request()->has($column)){
            $leads = $leads->where($column, request($column));
            $queries[$column] = request($column);
        }
    }

    $leads = $leads->paginate($this->limit)->appends($queries);
    return view('leads.result', compact('leads'));

VIEW

{!! $leads->render() !!}

0 likes
7 replies
Snapey's avatar

What URLs do you see when you hover the links

Snapey's avatar

So that looks ok?

Tell us more about the error. Where does it fail?

mancoeg's avatar

@SNAPEY - that is the problem, i see that everything is ok, and it works fine if i appends only one variable, but it fails when i send many variables within $queries array. if you have any method to debug this code, please let me know.

Snapey's avatar

Well the error is related to encryption, but I don't see how this is relevant to the query string.

Can you confirm by listing the file and error line of the exception?

Whoops should tell you this, but if not, check the Laravel log file.

Please or to participate in this conversation.