{"action":"created","issue":{"url":"https://api.github.com/repos/adonisjs/adonis-framework/issues/176","repository_url":"https://api.github.com/repos/adonisjs/adonis-framework","labels_url":"https://api.github.com/repos/adonisjs/adonis-framework/issues/176/labels{/name}","comments_url":"https://api.github.com/repos/adonisjs/adonis-framework/issues/176/comments","events_url":"https://api.github.com/repos/adonisjs/adonis-framework/issues/176/events","html_url":"https://github.com/adonisjs/adonis-framework/issues/176","id":158355564,"number":176,"title":"hi i want to write queries in model like this, is it possible?","user":{"login":"Jamesoncy","id":12342949,"avatar_url":"https://avatars.githubusercontent.com/u/12342949?v=3","gravatar_id":"","url":"https://api.github.com/users/Jamesoncy","html_url":"https://github.com/Jamesoncy","followers_url":"https://api.github.com/users/Jamesoncy/followers","following_url":"https://api.github.com/users/Jamesoncy/following{/other_user}","gists_url":"https://api.github.com/users/Jamesoncy/gists{/gist_id}","starred_url":"https://api.github.com/users/Jamesoncy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jamesoncy/subscriptions","organizations_url":"https://api.github.com/users/Jamesoncy/orgs","repos_url":"https://api.github.com/users/Jamesoncy/repos","events_url":"https://api.github.com/users/Jamesoncy/events{/privacy}","received_events_url":"https://api.github.com/users/Jamesoncy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"thetutlage","id":1706381,"avatar_url":"https://avatars.githubusercontent.com/u/1706381?v=3","gravatar_id":"","url":"https://api.github.com/users/thetutlage","html_url":"https://github.com/thetutlage","followers_url":"https://api.github.com/users/thetutlage/followers","following_url":"https://api.github.com/users/thetutlage/following{/other_user}","gists_url":"https://api.github.com/users/thetutlage/gists{/gist_id}","starred_url":"https://api.github.com/users/thetutlage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thetutlage/subscriptions","organizations_url":"https://api.github.com/users/thetutlage/orgs","repos_url":"https://api.github.com/users/thetutlage/repos","events_url":"https://api.github.com/users/thetutlage/events{/privacy}","received_events_url":"https://api.github.com/users/thetutlage/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2016-06-03T12:24:37Z","updated_at":"2016-06-03T13:55:10Z","closed_at":null,"body":"class Log extends Model {\r\n  /**\r\n   * Log Model Constructor\r\n   */\r\n  constructor () {\r\n    super();\r\n  }\r\n\r\n  /**\r\n   * Adds a new log of the given transaction.\r\n   * @access public\r\n   * @param transactionId .. Id that identifies a unique transaction (generated by providers)\r\n   * @param body .. body of the transaction\r\n   * @param type .. this can be incoming or outgoing\r\n   * @returns {*}\r\n   */\r\n  *addLog (transactionId, body, type) {\r\n    return yield this.query(\r\n      'INSERT INTO logs(transaction_id, body, type) VALUES (?,?,?)',\r\n      [transactionId, body, type]\r\n    );\r\n  }\r\n\r\n}"},"comment":{"url":"https://api.github.com/repos/adonisjs/adonis-framework/issues/comments/223584972","html_url":"https://github.com/adonisjs/adonis-framework/issues/176#issuecomment-223584972","issue_url":"https://api.github.com/repos/adonisjs/adonis-framework/issues/176","id":223584972,"user":{"login":"RomainLanz","id":2793951,"avatar_url":"https://avatars.githubusercontent.com/u/2793951?v=3","gravatar_id":"","url":"https://api.github.com/users/RomainLanz","html_url":"https://github.com/RomainLanz","followers_url":"https://api.github.com/users/RomainLanz/followers","following_url":"https://api.github.com/users/RomainLanz/following{/other_user}","gists_url":"https://api.github.com/users/RomainLanz/gists{/gist_id}","starred_url":"https://api.github.com/users/RomainLanz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RomainLanz/subscriptions","organizations_url":"https://api.github.com/users/RomainLanz/orgs","repos_url":"https://api.github.com/users/RomainLanz/repos","events_url":"https://api.github.com/users/RomainLanz/events{/privacy}","received_events_url":"https://api.github.com/users/RomainLanz/received_events","type":"User","site_admin":false},"created_at":"2016-06-03T13:55:10Z","updated_at":"2016-06-03T13:55:10Z","body":"@Jamesoncy You should first take a look at the Active Record pattern.\r\n\r\n* [Active Record](http://guides.rubyonrails.org/active_record_basics.html)\r\n* [AdonisJs Lucid](http://dev.adonisjs.com/docs/3.0/lucid)\r\n\r\n--\r\n\r\nFor your problem, you need to return the `response`."}}
{"actor":{"display_login":"RomainLanz"}}