How to get record in between range of quantity?

Posted 4 months ago by Crazylife

I have records as shown below

    id | min | max
    1       5   15
    2       15  null

For example, my query

$test = test::where('max' , '>=', 16)->where('min' , '<=', 16)->get();

I want to make the null value as infinity while getting the result. How can i make it like if i put 10 then it will return result id = 1 for me. if put 16 then will return id = 2?

Please sign in or create an account to participate in this conversation.