I have three tables:
object | product | object_product
object product object_product
______ _______ ______________
id title id title id_object id_product
1 Maga 1 Cola 1 1
I have the following query builder:
$products = Product::with("categories.names")->where(function ($query) use ($request) {
})->with('images')->orderBy('id', 'desc')->paginate($limit)->toArray();
I need to get all products of selected object place_id.
I tried to do this in constructor query body:
if (($request->get("place_id"))) {
// HERE JOIN TO TABLE object_product
}
But