Merge branch 'master' into develop
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user