{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/12668","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/12668/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/12668/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/12668/events","html_url":"https://github.com/laravel/framework/pull/12668","id":139278268,"number":12668,"title":"Return only entered items in Request::only()","user":{"login":"behzadsh","id":635441,"avatar_url":"https://avatars.githubusercontent.com/u/635441?v=3","gravatar_id":"","url":"https://api.github.com/users/behzadsh","html_url":"https://github.com/behzadsh","followers_url":"https://api.github.com/users/behzadsh/followers","following_url":"https://api.github.com/users/behzadsh/following{/other_user}","gists_url":"https://api.github.com/users/behzadsh/gists{/gist_id}","starred_url":"https://api.github.com/users/behzadsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/behzadsh/subscriptions","organizations_url":"https://api.github.com/users/behzadsh/orgs","repos_url":"https://api.github.com/users/behzadsh/repos","events_url":"https://api.github.com/users/behzadsh/events{/privacy}","received_events_url":"https://api.github.com/users/behzadsh/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-03-08T13:30:09Z","updated_at":"2016-06-27T07:53:32Z","closed_at":"2016-03-08T16:07:29Z","pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/12668","html_url":"https://github.com/laravel/framework/pull/12668","diff_url":"https://github.com/laravel/framework/pull/12668.diff","patch_url":"https://github.com/laravel/framework/pull/12668.patch"},"body":"Before setting selected item in result array, check if the items exist in inputs.\r\n\r\nConsider a situation that you want to update a model, and you do something like this:\r\n\r\n```php\r\n// ...\r\n\r\nclass PostController extend Controller {\r\n\r\n    // ...\r\n\r\n    public function update(Request $request, $postId) {\r\n        $post = Post::find($postId);\r\n        $post->update($request->only(['title', 'content']));\r\n\r\n        return $post;\r\n    }\r\n\r\n    // ...\r\n\r\n}\r\n\r\n// ...\r\n```\r\n\r\nIn this situation if I only want to update post `content` and send only `content` value (with PATCH/PUT method), `$request->only(['title', 'content'])` will return  `title` as `null`. And if title column is nullable it would be updated to `null`.\r\n\r\n***Sample request:***\r\n```json\r\n{\r\n    \"content\": \"lorem ipsum ...\"\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/228676814","html_url":"https://github.com/laravel/framework/pull/12668#issuecomment-228676814","issue_url":"https://api.github.com/repos/laravel/framework/issues/12668","id":228676814,"user":{"login":"GrahamCampbell","id":2829600,"avatar_url":"https://avatars.githubusercontent.com/u/2829600?v=3","gravatar_id":"","url":"https://api.github.com/users/GrahamCampbell","html_url":"https://github.com/GrahamCampbell","followers_url":"https://api.github.com/users/GrahamCampbell/followers","following_url":"https://api.github.com/users/GrahamCampbell/following{/other_user}","gists_url":"https://api.github.com/users/GrahamCampbell/gists{/gist_id}","starred_url":"https://api.github.com/users/GrahamCampbell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GrahamCampbell/subscriptions","organizations_url":"https://api.github.com/users/GrahamCampbell/orgs","repos_url":"https://api.github.com/users/GrahamCampbell/repos","events_url":"https://api.github.com/users/GrahamCampbell/events{/privacy}","received_events_url":"https://api.github.com/users/GrahamCampbell/received_events","type":"User","site_admin":false},"created_at":"2016-06-27T07:53:32Z","updated_at":"2016-06-27T07:53:32Z","body":"The behaviour we want is to include all keys, even if not there already. I agree the docs are confusing."}}
{"actor":{"display_login":"GrahamCampbell"}}