function getAll(Request $request, Response $response) { $response = $response->withHeader('Content-type', 'application/json'); $data = Sector::all(); if (count($data) == 0) { $response = $response->withStatus(404); } $response->getBody()->write($data); return $response; }
public function getSectoresall() { $sectores = Sector::all(); return Response::Json($sectores); }