From 9717d2b45d96c626b1e855be568fd7cb0e64619f Mon Sep 17 00:00:00 2001 From: Jelle Breuer Date: Mon, 25 Oct 2021 10:57:24 +0200 Subject: [PATCH] Add data to ResponseCreated event --- src/Events/ResponseCreated.php | 5 ++++- src/Http/Responses/DataResponse.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Events/ResponseCreated.php b/src/Events/ResponseCreated.php index ff78d44860..7df4e2eed2 100644 --- a/src/Events/ResponseCreated.php +++ b/src/Events/ResponseCreated.php @@ -11,11 +11,14 @@ class ResponseCreated extends Event */ public $response; + public $data; + /** * @param Response $response */ - public function __construct(Response $response) + public function __construct(Response $response, $data) { $this->response = $response; + $this->data = $data; } } diff --git a/src/Http/Responses/DataResponse.php b/src/Http/Responses/DataResponse.php index e4a590686c..6c2103fa3b 100644 --- a/src/Http/Responses/DataResponse.php +++ b/src/Http/Responses/DataResponse.php @@ -45,7 +45,7 @@ public function toResponse($request) ->make($this->contents()) ->withHeaders($this->headers); - ResponseCreated::dispatch($response); + ResponseCreated::dispatch($response, $this->data); return $response; }