Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
13638467
Commit
13638467
authored
May 02, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added Response::json method.
parent
f6b7e5f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
changes.md
laravel/documentation/changes.md
+1
-0
response.php
laravel/response.php
+20
-0
No files found.
laravel/documentation/changes.md
View file @
13638467
...
@@ -68,6 +68,7 @@
...
@@ -68,6 +68,7 @@
-
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 Input::json() method for working with applications using Backbone.js or similar.
-
Added Input::json() method for working with applications using Backbone.js or similar.
-
Added Response::json method for creating JSON responses.
<a
name=
"upgrade-3.2"
></a>
<a
name=
"upgrade-3.2"
></a>
## Upgrading From 3.1
## Upgrading From 3.1
...
...
laravel/response.php
View file @
13638467
...
@@ -78,6 +78,26 @@ class Response {
...
@@ -78,6 +78,26 @@ class Response {
return
new
static
(
View
::
make
(
$view
,
$data
));
return
new
static
(
View
::
make
(
$view
,
$data
));
}
}
/**
* Create a new JSON response.
*
* <code>
* // Create a response instance with a view
* return Response::json($data, 200, array('header' => 'value'));
* </code>
*
* @param mixed $data
* @param int $status
* @param array $headers
* @return Response
*/
public
static
function
json
(
$data
,
$status
=
200
,
$headers
=
array
())
{
$headers
[
'Content-Type'
]
=
'application/json'
;
return
new
static
(
json_encode
(
$data
),
$status
,
$headers
);
}
/**
/**
* Create a new error response instance.
* Create a new error response instance.
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment