Skip to content

Commit

Permalink
Add data to ResponseCreated event (#4569)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbreuer95 authored Oct 25, 2021
1 parent b666ccc commit 3c1fac4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Events/ResponseCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion src/Http/Responses/DataResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function toResponse($request)
->make($this->contents())
->withHeaders($this->headers);

ResponseCreated::dispatch($response);
ResponseCreated::dispatch($response, $this->data);

return $response;
}
Expand Down

0 comments on commit 3c1fac4

Please sign in to comment.