Support the ongoing development of Laravel.io →
Database
Last updated 2 years ago.
0

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 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.