Skip to content

Commit cf4612c

Browse files
committed
document relative date methods
1 parent 8561390 commit cf4612c

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

queries.md

+46
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,52 @@ The `whereTime` method may be used to compare a column's value against a specifi
775775
->whereTime('created_at', '=', '11:20:45')
776776
->get();
777777

778+
**wherePast / whereFuture / whereToday / whereBeforeToday / whereAfterToday**
779+
780+
The `wherePast` and `whereFuture` methods may be used to determine if a column's value is in the past or future:
781+
782+
$invoices = DB::table('invoices')
783+
->wherePast('due_at')
784+
->get();
785+
786+
$invoices = DB::table('invoices')
787+
->whereFuture('due_at')
788+
->get();
789+
790+
The `whereNowOrPast` and `whereNowOrFuture` methods may be used to determine if a column's value is in the past or future, inclusive of the current date and time:
791+
792+
$invoices = DB::table('invoices')
793+
->whereNowOrPast('due_at')
794+
->get();
795+
796+
$invoices = DB::table('invoices')
797+
->whereNowOrFuture('due_at')
798+
->get();
799+
800+
The `whereToday`, `whereBeforeToday`, and `whereAfterToday` methods may be used to determine if a column's value is today, before today, or after today, respectively:
801+
802+
$invoices = DB::table('invoices')
803+
->whereToday('due_at')
804+
->get();
805+
806+
$invoices = DB::table('invoices')
807+
->whereBeforeToday('due_at')
808+
->get();
809+
810+
$invoices = DB::table('invoices')
811+
->whereAfterToday('due_at')
812+
->get();
813+
814+
Similarly, the `whereTodayOrBefore` and `whereTodayOrAfter` methods may be used to determine if a column's value is before today or after today, inclusive of today's date:
815+
816+
$invoices = DB::table('invoices')
817+
->whereTodayOrBefore('due_at')
818+
->get();
819+
820+
$invoices = DB::table('invoices')
821+
->whereTodayOrAfter('due_at')
822+
->get();
823+
778824
**whereColumn / orWhereColumn**
779825

780826
The `whereColumn` method may be used to verify that two columns are equal:

0 commit comments

Comments
 (0)