Skip to content

Commit af44977

Browse files
committed
fix: patch up validation returnFullData
1 parent 32e152e commit af44977

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/Request.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Request
2727

2828
protected static $errors = [];
2929
protected static $formDataMediaTypes = ['application/x-www-form-urlencoded'];
30-
30+
3131
/**
3232
* Internal instance of Leaf Form
3333
* @var \Leaf\Form
@@ -236,7 +236,7 @@ public static function params(string $key = null, $default = null)
236236
{
237237
return static::get($key) ?? $default;
238238
}
239-
239+
240240
/**
241241
* Returns request data
242242
*
@@ -336,10 +336,10 @@ public static function headers($key = null, bool $safeData = true)
336336

337337
/**
338338
* Validate the request data
339-
*
339+
*
340340
* @param array $rules The rules to validate against
341341
* @param boolean $returnFullData Return the full data or just the validated data?
342-
*
342+
*
343343
* @return false|array Returns false if validation fails, or the validated data if validation passes
344344
*/
345345
public static function validate(array $rules, bool $returnFullData = false)
@@ -354,7 +354,7 @@ public static function validate(array $rules, bool $returnFullData = false)
354354
return false;
355355
}
356356

357-
return $returnFullData ? $data : static::get(array_keys($rules));
357+
return $returnFullData ? static::body() : $data;
358358
}
359359

360360
/**
@@ -399,7 +399,7 @@ public static function user()
399399

400400
/**
401401
* Get data passed from the previous middleware
402-
*
402+
*
403403
* @param string|null $key The key to get from the middleware data
404404
*/
405405
public static function next($key = null)
@@ -415,7 +415,7 @@ public static function next($key = null)
415415
* @param string $key The name of the file input the request.
416416
* @param string $destination The directory where the file should be stored.
417417
* @param array $config Optional configurations: max_file_size, file_type, extensions
418-
*
418+
*
419419
* @return array|false An array containing the status or false for a failure.
420420
*/
421421
public static function upload(string $key, string $destination, array $config = [])
@@ -435,13 +435,13 @@ public static function upload(string $key, string $destination, array $config =
435435
return false;
436436
}
437437
}
438-
438+
439439
$fileSystem = new \Leaf\FS;
440440

441441
if (!isset($config['rename']) || !$config['rename']) {
442442
$config['unique'] = true;
443443
}
444-
444+
445445
$uploadedFile = $fileSystem->uploadFile(
446446
$file,
447447
preg_replace(
@@ -462,7 +462,7 @@ public static function upload(string $key, string $destination, array $config =
462462

463463
/**
464464
* Store a file from the request with a given name
465-
*
465+
*
466466
* @param string $key The name of the file input the request.
467467
* @param string $destination The directory where the file should be stored.
468468
* @param string $name The name to store the file as.

0 commit comments

Comments
 (0)