{"action":"created","issue":{"url":"https://api.github.com/repos/octobercms/october/issues/2507","repository_url":"https://api.github.com/repos/octobercms/october","labels_url":"https://api.github.com/repos/octobercms/october/issues/2507/labels{/name}","comments_url":"https://api.github.com/repos/octobercms/october/issues/2507/comments","events_url":"https://api.github.com/repos/octobercms/october/issues/2507/events","html_url":"https://github.com/octobercms/october/pull/2507","id":191510085,"number":2507,"title":"Use the otherKey to update a relation","user":{"login":"oliverpool","id":3864879,"avatar_url":"https://avatars.githubusercontent.com/u/3864879?v=3","gravatar_id":"","url":"https://api.github.com/users/oliverpool","html_url":"https://github.com/oliverpool","followers_url":"https://api.github.com/users/oliverpool/followers","following_url":"https://api.github.com/users/oliverpool/following{/other_user}","gists_url":"https://api.github.com/users/oliverpool/gists{/gist_id}","starred_url":"https://api.github.com/users/oliverpool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliverpool/subscriptions","organizations_url":"https://api.github.com/users/oliverpool/orgs","repos_url":"https://api.github.com/users/oliverpool/repos","events_url":"https://api.github.com/users/oliverpool/events{/privacy}","received_events_url":"https://api.github.com/users/oliverpool/received_events","type":"User","site_admin":false},"labels":[{"id":247986935,"url":"https://api.github.com/repos/octobercms/october/labels/Status:%20Revision%20Needed","name":"Status: Revision Needed","color":"e11d21","default":false},{"id":143609184,"url":"https://api.github.com/repos/octobercms/october/labels/Type:%20Enhancement","name":"Type: Enhancement","color":"84b6eb","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-24T12:36:14Z","updated_at":"2016-11-27T21:45:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/octobercms/october/pulls/2507","html_url":"https://github.com/octobercms/october/pull/2507","diff_url":"https://github.com/octobercms/october/pull/2507.diff","patch_url":"https://github.com/octobercms/october/pull/2507.patch"},"body":"If the `otherKey` of the relationship was set, the widget was considering the wrong column name.\r\n\r\n## To reproduce:\r\nCreate a model with a custom `otherKey`\r\n```php\r\npublic $belongsTo = [\r\n    'library' => ['Library', 'key' => 'library_id', 'otherKey' => 'national_id']\r\n];\r\n```\r\nAdd a widget with this relation in some backend form.\r\n\r\nLook in the database after edition: the `library_id` took the `id` of the Library (and not the `national_id`)"},"comment":{"url":"https://api.github.com/repos/octobercms/october/issues/comments/263149858","html_url":"https://github.com/octobercms/october/pull/2507#issuecomment-263149858","issue_url":"https://api.github.com/repos/octobercms/october/issues/2507","id":263149858,"user":{"login":"daftspunk","id":1392869,"avatar_url":"https://avatars.githubusercontent.com/u/1392869?v=3","gravatar_id":"","url":"https://api.github.com/users/daftspunk","html_url":"https://github.com/daftspunk","followers_url":"https://api.github.com/users/daftspunk/followers","following_url":"https://api.github.com/users/daftspunk/following{/other_user}","gists_url":"https://api.github.com/users/daftspunk/gists{/gist_id}","starred_url":"https://api.github.com/users/daftspunk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daftspunk/subscriptions","organizations_url":"https://api.github.com/users/daftspunk/orgs","repos_url":"https://api.github.com/users/daftspunk/repos","events_url":"https://api.github.com/users/daftspunk/events{/privacy}","received_events_url":"https://api.github.com/users/daftspunk/received_events","type":"User","site_admin":false},"created_at":"2016-11-27T21:45:25Z","updated_at":"2016-11-27T21:45:25Z","body":"October calls it \"otherKey\" so we should have a method to match. This has been added to the library in https://github.com/octobercms/library/commit/afa1985ed282b3bddad054c625d0184b4f6a7e19 so this PR can be accepted. Thanks!"}}
{"actor":{"display_login":"daftspunk"}}