#Where with range query question

3 messages · Page 1 of 1 (latest)

tawdry laurel
#

Hello i'm currently learning laravel by making a project and i was wondering how can i ask for data in a range of values like this mysql query SELECT * FROM games where height between 47 and 52 and width between 47 and 52; i've been looking into the documentation for something like "between" but i don't find something useful for me

crisp cove
#

You can use whereBetween with Eloquent models too, since they extend the query builder:

$games = Game::query()
    ->whereBetween('height', [min, max])
    ->whereBetween('width', [min, max])
    ->get();