Skip to content

Commit d1cf1df

Browse files
[9.x] Add the whereBetweenColumns method and relevant ones. (laravel#8249)
* Add the whereBetweenColumns method and relevant ones. * Update queries.md * Update queries.md Co-authored-by: Taylor Otwell <[email protected]>
1 parent 6588261 commit d1cf1df

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

queries.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,20 @@ The `whereNotBetween` method verifies that a column's value lies outside of two
532532
->whereNotBetween('votes', [1, 100])
533533
->get();
534534

535+
**whereBetweenColumns / whereNotBetweenColumns / orWhereBetweenColumns / orWhereNotBetweenColumns**
536+
537+
The `whereBetweenColumns` method verifies that a column's value is between the two values of two columns in the same table row:
538+
539+
$patients = DB::table('patients')
540+
->whereBetweenColumns('weight', ['minimum_allowed_weight', 'maximum_allowed_weight'])
541+
->get();
542+
543+
The `whereNotBetweenColumns` method verifies that a column's value lies outside the two values of two columns in the same table row:
544+
545+
$patients = DB::table('patients')
546+
->whereNotBetweenColumns('weight', ['minimum_allowed_weight', 'maximum_allowed_weight'])
547+
->get();
548+
535549
**whereIn / whereNotIn / orWhereIn / orWhereNotIn**
536550

537551
The `whereIn` method verifies that a given column's value is contained within the given array:

0 commit comments

Comments
 (0)