function index_put() { $models = json_decode($this->put('models')); $data["results"] = array(); $data["count"] = 0; foreach ($models as $value) { $obj = new Price_list(null, $this->entity); $obj->get_by_id($value->id); $obj->currency_id = $value->currency_id; $obj->product_id = $value->product_id; $obj->unit_id = $value->unit_id; $obj->price = $value->price; $obj->unit_value = $value->unit_value; if ($obj->save()) { //Results $data["results"][] = array("id" => $obj->id, "currency_id" => $obj->currency_id, "product_id" => $obj->product_id, "unit_id" => $obj->unit_id, "price" => floatval($obj->price), "unit_value" => floatval($obj->unit_value), "currency" => $obj->currency->get_raw()->result(), "unit" => $obj->unit->get()->name); } } $data["count"] = count($data["results"]); $this->response($data, 200); }