diff --git a/src/Response.php b/src/Response.php index 84fe197d..16e043b4 100644 --- a/src/Response.php +++ b/src/Response.php @@ -9,9 +9,12 @@ use Illuminate\Support\Arr; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Response as ResponseFactory; +use Illuminate\Support\Traits\Macroable; class Response implements Responsable { + use Macroable; + protected $component; protected $props; protected $rootView; diff --git a/tests/ResponseTest.php b/tests/ResponseTest.php index fffdbddf..62b8a751 100644 --- a/tests/ResponseTest.php +++ b/tests/ResponseTest.php @@ -17,6 +17,16 @@ class ResponseTest extends TestCase { + public function test_can_macro() + { + $response = new Response('User/Edit', []); + $response->macro('foo', function () { + return 'bar'; + }); + + $this->assertEquals('bar', $response->foo()); + } + public function test_server_response() { $request = Request::create('/user/123', 'GET');