Listado proyectos
This commit is contained in:
13
app/src/Controller/API/withJson.php
Normal file
13
app/src/Controller/API/withJson.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace Incoviba\Controller\API;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
trait withJson
|
||||
{
|
||||
public function withJson(ResponseInterface $response, array $data = []): ResponseInterface
|
||||
{
|
||||
$response->getBody()->write(json_encode($data));
|
||||
return $response->withHeader('Content-Type', 'application/json');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user