Support the ongoing development of →
Last updated 1 year ago.

This was answered for me on another forum. Here is the answer using with a dynamic WHERE clause.

That works perfectly! Thank you very much for your time! For anyone that may find this code in the future, here is how to do the pagination after the query call using append() to send additional values

    $query = DB::table('tableName');
    if(Input::has('someinput')) {
        $query->where('someinput', Input::get('someinput'));
    if(Input::has('otherinput')) {
        $query->where('otherinput', Input::get('otherinput'));
    $results = $query->paginate(50);
    $pagination = $results->appends(array('value' => 'key'));

    return View::make('view', array('results' => $results, 'pagination' => $pagination));

Then to display the pagination in your view simple echo the $pagination variable.

    //standard syntax
    <?php echo $pagination; ?>

    //blade syntax
    {{ $pagination }}
Last updated 1 year ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.