Merge branch 'master' into develop

This commit is contained in:
Taylor Otwell
2013-01-05 14:36:48 -06:00
3 changed files with 28 additions and 4 deletions

View File

@@ -100,6 +100,26 @@ class Response {
}
/**
* Create a new JSONP response.
*
* <code>
* // Create a response instance with JSONP
* return Response::jsonp('myFunctionCall', $data, 200, array('header' => 'value'));
* </code>
*
* @param mixed $data
* @param int $status
* @param array $headers
* @return Response
*/
public static function jsonp($callback, $data, $status = 200, $headers = array())
{
$headers['Content-Type'] = 'application/javascript; charset=utf-8';
return new static($callback.'('.json_encode($data).');', $status, $headers);
}
/**
* Create a new response of JSON'd Eloquent models.
*
@@ -346,4 +366,4 @@ class Response {
return $this->render();
}
}
}