Skip to content

Commit a06a15d

Browse files
committed
Json Output
1 parent be3f050 commit a06a15d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Outputs/Json.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
namespace BeyondCode\QueryDetector\Outputs;
3+
4+
use Illuminate\Support\Collection;
5+
use Symfony\Component\HttpFoundation\Response;
6+
use Illuminate\Http\JsonResponse;
7+
8+
class Json implements Output
9+
{
10+
11+
public function output(Collection $detectedQueries, Response $response)
12+
{
13+
if ($response instanceof JsonResponse) {
14+
$data = $response->getData(true);
15+
$data['warning_queries'] = $detectedQueries;
16+
$response->setData($data);
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)