Answer the question
In order to leave comments, you need to log in
How to make a correct request to the Laravel database?
Hello uv. connoisseurs, I have a problem with the request, in general, in fact, I want to do the right filter by price, and then I got a hitch with the wording of the request. The table has 2 fields with prices price_weekend_max and price_weekend_max_comm when displaying these prices, I add them, i.e. $c->price_weekend_max + $c->price_weekend_max_comm and I get one single price for which I am trying to make a filter. The filter itself works according to the following principle: the usual slider from one price to another, min \ max, the prices are transferred to the method and there I want to filter the data with a query
$filtered_items = Cottage::orderBy('priority', 'desc');
$filtered_items = $filtered_items
->where('price_weekend_max + price_weekend_max_comm','>=', $data['price_from'])
->where('price_weekend_max + price_weekend_max_comm','<=', $data['price_to']);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question