File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -310,18 +310,19 @@ public static function headers($key = null, bool $safeData = true)
310310 * Validate the request data
311311 *
312312 * @param array $rules The rules to validate against
313+ * @param boolean $returnFullData Return the full data or just the validated data?
313314 *
314315 * @return false|array Returns false if validation fails, or the validated data if validation passes
315316 */
316- public static function validate (array $ rules )
317+ public static function validate (array $ rules, bool $ returnFullData = false )
317318 {
318319 $ data = \Leaf \Form::validate (static ::body (false ), $ rules );
319320
320321 if ($ data === false ) {
321322 return false ;
322323 }
323324
324- return static ::body ( );
325+ return $ returnFullData ? $ data : static ::get ( array_keys ( $ rules ) );
325326 }
326327
327328 /**
@@ -331,7 +332,7 @@ public static function validate(array $rules)
331332 protected static function auth ()
332333 {
333334 if (!class_exists ('\Leaf\Auth ' )) {
334- throw new \Exception (" You need to install the leafs/auth package to use the auth helper " );
335+ throw new \Exception (' You need to install the leafs/auth package to use the auth helper ' );
335336 }
336337
337338 if (!(\Leaf \Config::get ('auth.instance ' ))) {
You can’t perform that action at this time.
0 commit comments