From 8ec2f9f527d3f17ee6c283119413de0a6bea191c Mon Sep 17 00:00:00 2001 From: jsalisbury Date: Thu, 2 Mar 2017 21:57:25 -0500 Subject: [PATCH] im a moron --- api/routes/nutrient.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 api/routes/nutrient.php diff --git a/api/routes/nutrient.php b/api/routes/nutrient.php new file mode 100644 index 0000000..2926551 --- /dev/null +++ b/api/routes/nutrient.php @@ -0,0 +1,25 @@ +get('/nutrient/all', function( $request, $response ) { + $q = new NutrientQuery; + $nuts = $q::create()->find(); + + $response_json = [ + "status" => [ + "code" => $response->getStatusCode(), + "message" => "OK" + ], + "data" => [] + ]; +//[strtolower($rule->getRank()->getName())][$rule->getNutrient()->getName()] + foreach( $nuts as $nut ) { + $response_json["data"][] = [ + "id" => $nut->getId(), + "name" => $nut->getName(), + ]; + + } + + $response = $response->withJSON($response_json); + return $response; + +}); \ No newline at end of file