From a1dc4c5119d1393e3005dd25c271f69631f2b727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Thu, 29 Mar 2018 22:35:21 +0200 Subject: [PATCH] Bugfixes - Updated `input` helper function. - Update documentation to reflect v4 changes in `InputHandler` class. --- README.md | 24 +++++++++++------------- helpers.php | 8 ++++---- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index de1bf4e..0592ed9 100644 --- a/README.md +++ b/README.md @@ -284,9 +284,9 @@ To implement the functions below, simply copy the code to a new file and require getInputHandler()->get($index, ...$methods) ?? $defaultValue; + return request()->getInputHandler()->getValue($index, $defaultValue, ...$methods); } return request()->getInputHandler(); @@ -1172,18 +1172,16 @@ $value = input($index, $defaultValue, $methods); ### Get parameter object -Will return an instance of `InputItem` or `InputFile` depending on the type. +The example below will return an instance of `InputItem` or `InputFile` depending on the type. You can use this in your html as it will render the value of the item. -However if you want to compare value in your if statements, you have to use -the `getValue` or use the `input()` instead. + +If you want to compare value in your if statements, you have to use the `getValue` or use the `input()` helper function instead. If items is grouped in the html, it will return an array of items. -**Note:** `getObject` will only return `$defaultValue` if the item doesn't exist. If you want `$defaultValue` to be returned if the item is empty, please use `input()` instead. - ```php -$object = input()->getObject($index, $defaultValue = null, $methods = null); +$object = input()->get($index, $defaultValue = null, $methods = null); ``` ### Return specific GET parameter (where name is the name of your parameter): @@ -1205,9 +1203,9 @@ $id = input($index, $defaultValue, $method); # -- match specific -- -$object = input($index, $defaultValue, 'get'); -$object = input($index, $defaultValue, 'post'); -$object = input($index, $defaultValue, 'file'); +$value = input($index, $defaultValue, 'get'); +$value = input($index, $defaultValue, 'post'); +$value = input($index, $defaultValue, 'file'); # -- or -- diff --git a/helpers.php b/helpers.php index 914c445..264df05 100644 --- a/helpers.php +++ b/helpers.php @@ -1,9 +1,9 @@ getInputHandler()->get($index, ...$methods) ?? $defaultValue; + return request()->getInputHandler()->getValue($index, $defaultValue, ...$methods); } return request()->getInputHandler();