From 81a2f5b9193e20fc01fbd382a13e004eb61abd0b Mon Sep 17 00:00:00 2001 From: Blaine Schmeisser Date: Mon, 15 Oct 2012 22:04:58 -0500 Subject: [PATCH] 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; } } }); ~~~ Signed-off-by: Blaine Schmeisser --- laravel/routing/route.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/routing/route.php b/laravel/routing/route.php index 090aa59e..1ce17f1a 100644 --- a/laravel/routing/route.php +++ b/laravel/routing/route.php @@ -129,7 +129,7 @@ public function call() // sure we have a valid Response instance. $response = Response::prepare($response); - Filter::run($this->filters('after'), array($response)); + Filter::run($this->filters('after'), array(&$response)); return $response; }