Support the ongoing development of Laravel.io →
posted 10 years ago
Database
Last updated 1 year ago.
0
public function getCategory($id)
{
    $category = Category::with(['products' => function($query) use($id) {
        $query->whereId($id);
        $query->where('price', '<', '500.00');
    }])->get();
}
Last updated 1 year ago.
0

Doesn't actually solve anything. I am concerned about making the pagination. Is there any fix to that?

Last updated 1 year ago.
0

what about this:

return Category::find( $category_id )->products()->where( 'price', '<', 500 )->paginate( 6 );
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Joker666 joker666 Joined 22 Feb 2014

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.