{"action":"created","issue":{"url":"https://api.github.com/repos/lametro/programacion-4-2015/issues/36","labels_url":"https://api.github.com/repos/lametro/programacion-4-2015/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/lametro/programacion-4-2015/issues/36/comments","events_url":"https://api.github.com/repos/lametro/programacion-4-2015/issues/36/events","html_url":"https://github.com/lametro/programacion-4-2015/issues/36","id":108987742,"number":36,"title":"Error con Update y Delete ","user":{"login":"FrancoMeriles","id":13789088,"avatar_url":"https://avatars.githubusercontent.com/u/13789088?v=3","gravatar_id":"","url":"https://api.github.com/users/FrancoMeriles","html_url":"https://github.com/FrancoMeriles","followers_url":"https://api.github.com/users/FrancoMeriles/followers","following_url":"https://api.github.com/users/FrancoMeriles/following{/other_user}","gists_url":"https://api.github.com/users/FrancoMeriles/gists{/gist_id}","starred_url":"https://api.github.com/users/FrancoMeriles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FrancoMeriles/subscriptions","organizations_url":"https://api.github.com/users/FrancoMeriles/orgs","repos_url":"https://api.github.com/users/FrancoMeriles/repos","events_url":"https://api.github.com/users/FrancoMeriles/events{/privacy}","received_events_url":"https://api.github.com/users/FrancoMeriles/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-30T00:43:14Z","updated_at":"2015-10-02T21:40:48Z","closed_at":"2015-10-02T21:40:48Z","body":"Hola profe, estamos probando la api y tenemos problemas, creamos una nueva base de datos con la tabla que se llama usuario y editamos la conexion y los campos de la tabla, pero cuando queremos crear un usuario nos dice que esta buscando la tabla users, aunque editamos la tabla que dice table('users') en table('usuarios') pero igual la sigue buscando\r\n\r\n![captura](https://cloud.githubusercontent.com/assets/13789088/10181597/a7557b76-66f0-11e5-9b9f-a59314be1ed3.PNG)\r\n\r\nPero si cambiamos de nombre la tabla en 'users' funciona bien\r\n\r\n![captura1](https://cloud.githubusercontent.com/assets/13789088/10181609/d0a5deda-66f0-11e5-911e-00c6f75b8d9f.PNG)\r\n\r\nOtra cosa tambien probamos editar y borrar que tampoco funciona, cuando lo editamos mediante post con postman (index.php/usuario/1) nos tira que los cambios se hicieron status 200 y los datos actualizados pero en la base de datos no cambia nada y cuando borramos (index.php/usuario/1) tambien nos muestra error=false status=200 pero no borra nada en la bd\r\n\r\nAca esta el codigo del index.php\r\n\r\n```php\r\n<?php\r\nrequire 'vendor/autoload.php';\r\nrequire 'Models/User.php';\r\n\r\n$app = new \\Slim\\Slim();\r\n\r\n$app->config('databases', [\r\n    'default' => [\r\n        'driver'    => 'mysql',\r\n        'host'      => 'localhost',\r\n        'database'  => 'geo',\r\n        'username'  => 'Geo',\r\n        'password'  => 'geoalquiler',\r\n        'charset'   => 'utf8',\r\n        'collation' => 'utf8_general_ci',\r\n        'prefix'    => ''\r\n    ]\r\n]);\r\n$app->add(new Zeuxisoo\\Laravel\\Database\\Eloquent\\ModelMiddleware);\r\n\r\n$app->view(new \\JsonApiView());\r\n$app->add(new \\JsonApiMiddleware());\r\n\r\n$app->get('/', function () use ($app) {\r\n$app->render(200,array('msg' =>'API INDEX'));\r\n});\r\n\r\n//Mostrar\r\n\r\n$app->get('/usuario', function () use ($app) {\r\n\t$db = $app->db->getConnection();\r\n\t$users = $db->table('usuarios')->select('Id', 'Nombre', 'Email')->get();\r\n\r\n\t$app->render(200,array('data' => $users));\r\n});\r\n\r\n//Insertar\r\n\r\n$app->put('/usuario', function () use ($app) {\r\n\t$name = $app->request->params('Nombre');\r\n\tif(empty($name)){\r\n\t\t$app->render(500,array(\r\n\t\t\t'error' => TRUE,\r\n            'msg'   => 'Introdusca su Nombre',\r\n        ));\r\n\t}\r\n\t$password = $app->request->params('Pass');\r\n\tif(empty($password)){\r\n\t\t$app->render(500,array(\r\n\t\t\t'error' => TRUE,\r\n            'msg'   => 'password is required',\r\n        ));\r\n\t}\r\n\t$email = $app->request->params('Email');\r\n\tif(empty($email)){\r\n\t\t$app->render(500,array(\r\n\t\t\t'error' => TRUE,\r\n            'msg'   => 'email is required',\r\n        ));\r\n\t}\r\n\r\n    $user = new User();\r\n    $user->Nombre = $app->request->params('Nombre');\r\n    $user->Pass = $app->request->params('Pass');\r\n    $user->Email = $app->request->params('Email');\r\n    $user->save();\r\n\r\n    $app->render(200,array('data' => $user->toArray()));\r\n});\r\n\r\n//Editar\r\n\r\n$app->post('/usuario/:id', function ($id) use ($app) {\r\n\r\n\t$name = $app->request->params('Nombre');\r\n\tif(empty($name)){\r\n\t\t$app->render(500,array(\r\n\t\t\t'error' => TRUE,\r\n            'msg'   => 'name is required',\r\n        ));\r\n\t}\r\n\t$password = $app->request->params('Pass');\r\n\tif(empty($password)){\r\n\t\t$app->render(500,array(\r\n\t\t\t'error' => TRUE,\r\n            'msg'   => 'paSSrd is required',\r\n        ));\r\n\t}\r\n\t$email = $app->request->params('Email');\r\n\tif(empty($email)){\r\n\t\t$app->render(500,array(\r\n\t\t\t'error' => TRUE,\r\n            'msg'   => 'email is required',\r\n        ));\r\n\t}\r\n\r\n\t$user = User::find($id);\r\n\tif(empty($user)){\r\n\t\t$app->render(404,array(\r\n\t\t\t'error' => TRUE,\r\n            'msg'   => 'user not found',\r\n        ));\r\n\t}\r\n    $user->Nombre = $app->request->params('Nombre');\r\n    $user->Pass = $app->request->params('Pass');\r\n    $user->Email = $app->request->params('Email');\r\n    $user->save();\r\n    $app->render(200,array('data' => $user->toArray()));\r\n});\r\n\r\n//Buscar por ID\r\n\r\n$app->get('/usuario/:id', function ($id) use ($app) {\r\n\t$user = User::find($id);\r\n\tif(empty($user)){\r\n\t\t$app->render(404,array(\r\n\t\t\t'error' => TRUE,\r\n            'msg'   => 'user not found',\r\n        ));\r\n\t}\r\n\t$app->render(200,array('data' => $user->toArray()));\r\n});\r\n\r\n//Eliminar\r\n\r\n$app->delete('/usuario/:id', function ($id) use ($app) {\r\n\t$user = User::find($id);\r\n\tif(empty($user)){\r\n\t\t$app->render(404,array(\r\n\t\t\t'error' => TRUE,\r\n            'msg'   => 'user not found',\r\n        ));\r\n\t}\r\n\r\n\t$user->delete();\r\n\t$app->render(200);\r\n});\r\n\r\n$app->run();\r\n?>\r\n```\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/lametro/programacion-4-2015/issues/comments/145161442","html_url":"https://github.com/lametro/programacion-4-2015/issues/36#issuecomment-145161442","issue_url":"https://api.github.com/repos/lametro/programacion-4-2015/issues/36","id":145161442,"user":{"login":"catrielmuller","id":2272323,"avatar_url":"https://avatars.githubusercontent.com/u/2272323?v=3","gravatar_id":"","url":"https://api.github.com/users/catrielmuller","html_url":"https://github.com/catrielmuller","followers_url":"https://api.github.com/users/catrielmuller/followers","following_url":"https://api.github.com/users/catrielmuller/following{/other_user}","gists_url":"https://api.github.com/users/catrielmuller/gists{/gist_id}","starred_url":"https://api.github.com/users/catrielmuller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/catrielmuller/subscriptions","organizations_url":"https://api.github.com/users/catrielmuller/orgs","repos_url":"https://api.github.com/users/catrielmuller/repos","events_url":"https://api.github.com/users/catrielmuller/events{/privacy}","received_events_url":"https://api.github.com/users/catrielmuller/received_events","type":"User","site_admin":false},"created_at":"2015-10-02T21:40:48Z","updated_at":"2015-10-02T21:40:48Z","body":"Respondido en Clase (2 Oct)"}}