{"action":"created","issue":{"url":"https://api.github.com/repos/anlutro/laravel-repository/issues/17","labels_url":"https://api.github.com/repos/anlutro/laravel-repository/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/anlutro/laravel-repository/issues/17/comments","events_url":"https://api.github.com/repos/anlutro/laravel-repository/issues/17/events","html_url":"https://github.com/anlutro/laravel-repository/issues/17","id":58474636,"number":17,"title":"Method update always return a boolean","user":{"login":"DarKDinDoN","id":1687854,"avatar_url":"https://avatars.githubusercontent.com/u/1687854?v=3","gravatar_id":"","url":"https://api.github.com/users/DarKDinDoN","html_url":"https://github.com/DarKDinDoN","followers_url":"https://api.github.com/users/DarKDinDoN/followers","following_url":"https://api.github.com/users/DarKDinDoN/following{/other_user}","gists_url":"https://api.github.com/users/DarKDinDoN/gists{/gist_id}","starred_url":"https://api.github.com/users/DarKDinDoN/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DarKDinDoN/subscriptions","organizations_url":"https://api.github.com/users/DarKDinDoN/orgs","repos_url":"https://api.github.com/users/DarKDinDoN/repos","events_url":"https://api.github.com/users/DarKDinDoN/events{/privacy}","received_events_url":"https://api.github.com/users/DarKDinDoN/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-21T20:57:24Z","updated_at":"2015-02-21T21:07:28Z","closed_at":"2015-02-21T20:59:27Z","body":"Hello,\r\n\r\nThank you for sharing this package that saves us a lot of time.\r\n\r\nI'm wondering why the update method always returns a boolean ?\r\n\r\nHere is an example : \r\n\r\n```php\r\n$user = $this->userRepository->findByAttributes(['email' => \\Input::get('email')]);\r\n$user = $this->userRepository->update($user, ['reset_token' => 'SomeUniqueId']);\r\n\r\n// Then I could send the updated user to a Mailer Service or a Notification Service\r\n// or even raise an event to do the job\r\n```\r\n\r\nSince the update method doesn't return an Eloquent instance when the operation succeed, how can I retreive the updated model instance ?\r\n\r\nThanks \r\n"},"comment":{"url":"https://api.github.com/repos/anlutro/laravel-repository/issues/comments/75392937","html_url":"https://github.com/anlutro/laravel-repository/issues/17#issuecomment-75392937","issue_url":"https://api.github.com/repos/anlutro/laravel-repository/issues/17","id":75392937,"user":{"login":"anlutro","id":163093,"avatar_url":"https://avatars.githubusercontent.com/u/163093?v=3","gravatar_id":"","url":"https://api.github.com/users/anlutro","html_url":"https://github.com/anlutro","followers_url":"https://api.github.com/users/anlutro/followers","following_url":"https://api.github.com/users/anlutro/following{/other_user}","gists_url":"https://api.github.com/users/anlutro/gists{/gist_id}","starred_url":"https://api.github.com/users/anlutro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anlutro/subscriptions","organizations_url":"https://api.github.com/users/anlutro/orgs","repos_url":"https://api.github.com/users/anlutro/repos","events_url":"https://api.github.com/users/anlutro/events{/privacy}","received_events_url":"https://api.github.com/users/anlutro/received_events","type":"User","site_admin":false},"created_at":"2015-02-21T21:07:28Z","updated_at":"2015-02-21T21:07:28Z","body":"I can add that the reason for this is that objects are always passed by reference in PHP. When you pass the `$user` variable to the `update()` method and the `update()` method does `$model->fill(..)` and so on, it's updating the exact same object/instance that the `$user` variable is pointing to.\r\n\r\nThis is unlike how arrays work, where whenever you pass an array to a method/function, a copy of the array is being made, and any changes to the array never leaves the scope of the method/function."}}