File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -308,21 +308,30 @@ public static function headers($key = null, bool $safeData = true)
308308
309309 /**
310310 * Validate the request data
311+ *
311312 * @param array $rules The rules to validate against
312- * @return bool
313+ *
314+ * @return false|array Returns false if validation fails, or the validated data if validation passes
313315 */
314316 public static function validate (array $ rules )
315317 {
316- return \Leaf \Form::validate (static ::body (false ), $ rules );
318+ $ data = \Leaf \Form::validate (static ::body (false ), $ rules );
319+
320+ if ($ data === false ) {
321+ return false ;
322+ }
323+
324+ return static ::body ();
317325 }
318326
319327 /**
328+ * Return the auth instance
320329 * @return \Leaf\Auth
321330 */
322331 protected static function auth ()
323332 {
324333 if (!class_exists ('\Leaf\Auth ' )) {
325- throw new \Exception ("You need to install the leaf- auth package to use the auth helper " );
334+ throw new \Exception ("You need to install the leafs/ auth package to use the auth helper " );
326335 }
327336
328337 if (!(\Leaf \Config::get ('auth.instance ' ))) {
You can’t perform that action at this time.
0 commit comments