added Requst::json method.
This commit is contained in:
parent
6d37a32466
commit
138d08c04b
|
|
@ -67,6 +67,7 @@ ## Laravel 3.2
|
||||||
- Allow a `starter` Closure to be defined in `bundles.php` to be run on Bundle::start.
|
- Allow a `starter` Closure to be defined in `bundles.php` to be run on Bundle::start.
|
||||||
- Allow the registration of custom database drivers.
|
- Allow the registration of custom database drivers.
|
||||||
- New, driver based authentication system.
|
- New, driver based authentication system.
|
||||||
|
- Added Request::json() method for working with applications using Backbone.js or similar.
|
||||||
|
|
||||||
<a name="upgrade-3.2"></a>
|
<a name="upgrade-3.2"></a>
|
||||||
## Upgrading From 3.1
|
## Upgrading From 3.1
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,13 @@ 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.
|
||||||
*
|
*
|
||||||
|
|
@ -72,6 +79,18 @@ 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.
|
||||||
*
|
*
|
||||||
|
|
@ -232,7 +251,7 @@ public static function detect_env(array $environments, $uri)
|
||||||
{
|
{
|
||||||
// Essentially we just want to loop through each environment pattern
|
// Essentially we just want to loop through each environment pattern
|
||||||
// and determine if the current URI matches the pattern and if so
|
// and determine if the current URI matches the pattern and if so
|
||||||
// we'll simply return the environment for that URI pattern.
|
// we will simply return the environment for that URI pattern.
|
||||||
foreach ($patterns as $pattern)
|
foreach ($patterns as $pattern)
|
||||||
{
|
{
|
||||||
if (Str::is($pattern, $uri))
|
if (Str::is($pattern, $uri))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue