public function delete($id = null) { if ($this->perm->can_delete == 'y') { if ($id) { $data = new State($id); $action = 'DELETE'; save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->state_name . ' State Detail'); $data->delete(); } } redirect("admin/" . $this->modules_name); }
$ratingDAO = new Rating(); $ratingDAO->delete($rating); echo '{"result":"ok"}'; }); $app->get('/state', function () { $stateDAO = new State(); $result = $stateDAO->get(); echo json_encode($result); }); $app->post('/state', function () { $request = \Slim\Slim::getInstance()->request(); $state = json_decode($request->getBody()); $stateDAO = new State(); $stateDAO->insert($state); echo '{"result":"ok"}'; }); $app->put('/state', function () { $request = \Slim\Slim::getInstance()->request(); $state = json_decode($request->getBody()); $stateDAO = new State(); $stateDAO->update($state); echo '{"result":"ok"}'; }); $app->delete('/state', function () { $request = \Slim\Slim::getInstance()->request(); $state = json_decode($request->getBody()); $stateDAO = new State(); $stateDAO->delete($state); echo '{"result":"ok"}'; }); $app->run();