I have a problem with put in kohana restfull api. It's looks like my $post doesn't work, because after i use this function i can only see 'Data not found!'. Any idea? Thanks for help. Here is my code.
$trg_id = $this->request->param('id');
if ($trg_id) {
$post = $this->request->post();
if ($post) {
$objTrackingGroup = ORM::factory('Orm_trackingGroup', $trg_id);
if ($objTrackingGroup->loaded()) {
$objTrackingGroup->values($post)
->save();
$this->rest_output($data, 200);
} else {
$data = array(
'code' => 500,
'error' => 'Unknown error'
);
$this->rest_output($data, 500);
}
} else {
$data = array(
'code' => 404,
'error' => 'Data not found!'
);
$this->rest_output($data, 404);
}
}else {
$data = array(
'code' => 404,
'error' => 'Data not found'
);
$this->rest_output($data, 404);
}