Firemaps's avatar

::paginate(n)->where('condition')

I can't seem to call pagination links in bootstrap when a where condition is present.

// This is what I am trying to do

// controller 
$stuff = Stuff::paginate(3)->where('condition', 1); // 3 items get placed onto the view and pop off as expected

// blade
// however below the div, {{ $stuff->links() }}, or {!! $stuff->links() !!} or {{ $stuff->render() }} // doesn't load the pages.

When I call

$stuff = Stuff::paginate(3); // controller
// {{ $stuff->links() }} // works fine, blade

How can I paginate with a where condition?

0 likes
2 replies
jlrdw's avatar

Do your where first paginate last

1 like

Please or to participate in this conversation.