I have a product table and a category table and the category_product table. I want to get products of a specific category then run an other query on the retrieved products using a column that belongs to products table. for example all products that belongs to mobile category and have price less than 1000$. how can i do that? and second question: how to add pagination to it?
UPDATE: solved
with a query like this:
$products = Category::where(['title' => 'mobile'] )->first()->pictures()->where('price', '<' , 1000)->latest()->paginate(10);