Can you please tell me trying to get the data that matches the condition

$products = App\Product::where([ ['area', '>', $filters['minArea']], ['area', '<', $filters['maxArea']] ]); 

But, for some reason, it returns an empty array .. What am I doing wrong?

  • and you on 2 where tried to break? App\Product::where('area', '>', $filters['minArea'])->where('area', '<', $filters['maxArea'])->get() , and By the way, you're about get () forgot - Orange_shadow
  • Tried, returns an empty array. And I also checked with get () .. - dexploizer
  • And here’s the query: $ products = App \ Product :: where ('area', '>', $ filters ['minArea']) -> get (); working out normally - dexploizer
  • one
    then look what the jamb can have in maxArea is not a number, or a number smaller than minArea or see if you have the right type in the table in terms of what it is int - Orange_shadow
  • Try whereBetween - sv458

1 answer 1

 $products = App\Product::whereBetween( 'area', [ $filters['minArea'], $filters['maxArea'] ], )->get();