laravel/laravel — pull request #1354 by BlaineSch (2012-10-16 03:17:49+00:00)
Title: Pass the response by reference so it can be overwritten in filters

You can edit the response but you can't overwrite it:
~~~ php
parameters;
// The 'type' is the last param
// example: /product/(:num).(:any)
$type = array_pop($params);
if($type == 'json') {
$res = Response::json($response->content->data);
foreach($response as $key => &$value) {
$response->$key = $res->$key;
}
}
});
~~~