File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
src/Illuminate/Validation Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -184,6 +184,14 @@ public static function date()
184184 return new Date ;
185185 }
186186
187+ /**
188+ * Get a datetime rule builder instance.
189+ */
190+ public static function dateTime (): Date
191+ {
192+ return (new Date )->format ('Y-m-d H:i:s ' );
193+ }
194+
187195 /**
188196 * Get an email rule builder instance.
189197 *
Original file line number Diff line number Diff line change @@ -64,6 +64,38 @@ public function todayOrAfter(): static
6464 return $ this ->afterOrEqual ('today ' );
6565 }
6666
67+ /**
68+ * Ensure the date is in the past.
69+ */
70+ public function past (): static
71+ {
72+ return $ this ->before ('now ' );
73+ }
74+
75+ /**
76+ * Ensure the date is in the future.
77+ */
78+ public function future (): static
79+ {
80+ return $ this ->after ('now ' );
81+ }
82+
83+ /**
84+ * Ensure the date is now or in the past.
85+ */
86+ public function nowOrPast (): static
87+ {
88+ return $ this ->beforeOrEqual ('now ' );
89+ }
90+
91+ /**
92+ * Ensure the date is now or in the future.
93+ */
94+ public function nowOrFuture (): static
95+ {
96+ return $ this ->afterOrEqual ('now ' );
97+ }
98+
6799 /**
68100 * Ensure the date is before the given date or date field.
69101 */
You can’t perform that action at this time.
0 commit comments