Answer the question
In order to leave comments, you need to log in
Laravel - How to make "and+and" condition instead of "or+or" in query?
$places = Place::where(DB::raw('(price/people)'), '<=', $price)->where('people', '>=', $people)->whereHas('metros', function ($query) use ($metros) {
$query->whereIn('metro_id', $metros);
})->whereHas('comforts', function ($query) use ($comforts) {
$query->whereIn('comfort_id', $comforts);
})->orderBy(DB::raw('(price/people)'), 'desc')->skip($offset)->take($take)->get();
Answer the question
In order to leave comments, you need to log in
The idea itself is here stackoverflow.com/a/11636084/1603055
Then transfer it to Laravel somehow.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question