{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/14214","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/14214/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/14214/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/14214/events","html_url":"https://github.com/laravel/framework/pull/14214","id":163628054,"number":14214,"title":"[5.3] Touch owners on save only if model is dirty","user":{"login":"dan-har","id":8581476,"avatar_url":"https://avatars.githubusercontent.com/u/8581476?v=3","gravatar_id":"","url":"https://api.github.com/users/dan-har","html_url":"https://github.com/dan-har","followers_url":"https://api.github.com/users/dan-har/followers","following_url":"https://api.github.com/users/dan-har/following{/other_user}","gists_url":"https://api.github.com/users/dan-har/gists{/gist_id}","starred_url":"https://api.github.com/users/dan-har/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dan-har/subscriptions","organizations_url":"https://api.github.com/users/dan-har/orgs","repos_url":"https://api.github.com/users/dan-har/repos","events_url":"https://api.github.com/users/dan-har/events{/privacy}","received_events_url":"https://api.github.com/users/dan-har/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-04T08:34:34Z","updated_at":"2016-07-11T14:44:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/14214","html_url":"https://github.com/laravel/framework/pull/14214","diff_url":"https://github.com/laravel/framework/pull/14214.diff","patch_url":"https://github.com/laravel/framework/pull/14214.patch"},"body":"It seems that the model ```save()``` method not behave correctly when saving model that is NOT dirty and the model set to touch its owners.\r\n\r\nSo lets say we have posts and comments \r\n```php\r\n\r\n$comment = Comment::find(1);\r\n\r\n// do something ...\r\n\r\n// $comment->isDirty() == false\r\n\r\n$comment->save();\r\n\r\n/** owner post timestamp is updating **/\r\n```\r\n\r\nIt results with the saved model ```updated_at``` attribute not changing but the owner model ```updated_at``` is changed.\r\n\r\nThis is a suggestion for fixing this issue. In this change the ```save``` method will return ```false``` if the model is not dirty.\r\n"},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/231755823","html_url":"https://github.com/laravel/framework/pull/14214#issuecomment-231755823","issue_url":"https://api.github.com/repos/laravel/framework/issues/14214","id":231755823,"user":{"login":"dan-har","id":8581476,"avatar_url":"https://avatars.githubusercontent.com/u/8581476?v=3","gravatar_id":"","url":"https://api.github.com/users/dan-har","html_url":"https://github.com/dan-har","followers_url":"https://api.github.com/users/dan-har/followers","following_url":"https://api.github.com/users/dan-har/following{/other_user}","gists_url":"https://api.github.com/users/dan-har/gists{/gist_id}","starred_url":"https://api.github.com/users/dan-har/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dan-har/subscriptions","organizations_url":"https://api.github.com/users/dan-har/orgs","repos_url":"https://api.github.com/users/dan-har/repos","events_url":"https://api.github.com/users/dan-har/events{/privacy}","received_events_url":"https://api.github.com/users/dan-har/received_events","type":"User","site_admin":false},"created_at":"2016-07-11T14:44:19Z","updated_at":"2016-07-11T14:44:19Z","body":"For updating timestamps, a more explicit way may be $model->touch(). \r\n\r\nThe problem with this behavior is that leads to non consistent data being saved in the database whether someone aware to it or not."}}
{"actor":{"display_login":"dan-har"}}