Eloquent/PHP range (from/to)

Viewed 699

For example, my database structure is:

+------------+----------+
| Range from | Range To |
+------------+----------+
|        100 |      200 |
|        220 |      250 |
|        500 |      600 |
|        620 |      700 |
+------------+----------+

I need to check the existence of number 500. That should return true because there is a row 500-600. Also 660 should return true because there is a row 620-700.

How can I query this with Eloquent efficiently or can I only do this with native PHP? I want to avoid using loops but I don't know if that's possible.

Thnx in advance.

5 Answers
Related