This commit is contained in:
2021-08-10 15:48:33 -04:00
parent a1519752cd
commit 2d4f48f3a9
39 changed files with 864 additions and 0 deletions

View File

@ -0,0 +1,13 @@
<?php
namespace Incoviba\Common\Define\Controller;
use Psr\Http\Message\ResponseInterface as Response;
trait Json {
public function withJson(Response $response, $data, int $status = 200): Response {
$response->getBody()->write(json_encode($data));
return $response
->withHeader('Content-Type', 'application/json')
->withStatus($status);
}
}