move json method to input class.
This commit is contained in:
parent
138d08c04b
commit
208eb8a380
|
@ -2,6 +2,13 @@
|
||||||
|
|
||||||
class Input {
|
class Input {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The JSON payload for applications using Backbone.js or similar.
|
||||||
|
*
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
public static $json;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The key used to store old input in the session.
|
* The key used to store old input in the session.
|
||||||
*
|
*
|
||||||
|
@ -92,6 +99,18 @@ public static function query($key = null, $default = null)
|
||||||
return array_get(Request::foundation()->query->all(), $key, $default);
|
return array_get(Request::foundation()->query->all(), $key, $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the JSON payload for the request.
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public static function json()
|
||||||
|
{
|
||||||
|
if ( ! is_null(static::$json)) return static::$json;
|
||||||
|
|
||||||
|
return static::$json = json_decode(Request::foundation()->getContent());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a subset of the items from the input data.
|
* Get a subset of the items from the input data.
|
||||||
*
|
*
|
||||||
|
|
|
@ -9,13 +9,6 @@ class Request {
|
||||||
*/
|
*/
|
||||||
public static $route;
|
public static $route;
|
||||||
|
|
||||||
/**
|
|
||||||
* The JSON payload for applications using Backbone.js or similar.
|
|
||||||
*
|
|
||||||
* @var object
|
|
||||||
*/
|
|
||||||
public static $json;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Symfony HttpFoundation Request instance.
|
* The Symfony HttpFoundation Request instance.
|
||||||
*
|
*
|
||||||
|
@ -79,18 +72,6 @@ public static function headers()
|
||||||
return static::foundation()->headers->all();
|
return static::foundation()->headers->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the JSON payload for the request.
|
|
||||||
*
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
public static function json()
|
|
||||||
{
|
|
||||||
if ( ! is_null(static::$json)) return static::$json;
|
|
||||||
|
|
||||||
return static::$json = json_decode(static::foundation()->getContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an item from the $_SERVER array.
|
* Get an item from the $_SERVER array.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue