{"action":"created","comment":{"url":"https://api.github.com/repos/dimsav/laravel-translatable/pulls/comments/46039304","id":46039304,"diff_hunk":"@@ -260,6 +261,40 @@ public function fill(array $attributes)\n     }\n \n     /**\n+     * Get the fillable attributes for the model.\n+     *\n+     * @return array\n+     */\n+    public function getFillable()\n+    {\n+        $fillable = parent::getFillable();\n+        $locales = $this->getLocales();\n+\n+        foreach ($this->translatedAttributes as $attribute) {\n+            if ($this->alwaysFillable() || $this->isFillable($attribute)) {\n+                foreach ($locales as $locale) {\n+                    $fillable[] = $this->getFillableLocalizedAttributeKey($attribute, $locale);\n+                }\n+                unset($fillable[array_search($attribute, $fillable)]);\n+            }\n+        }\n+\n+        return $fillable;\n+    }\n+\n+    /**\n+     * Get the localized attribute key for use in the $fillable array.\n+     *\n+     * @param string $key\n+     * @param string $locale\n+     * @return array\n+     */\n+    protected function getFillableLocalizedAttributeKey($key, $locale)","path":"src/Translatable/Translatable.php","position":46,"original_position":46,"commit_id":"cab3d120a9e7ffaf8d01160aab2a8f49265c43cc","original_commit_id":"cab3d120a9e7ffaf8d01160aab2a8f49265c43cc","user":{"login":"dimsav","id":1785686,"avatar_url":"https://avatars.githubusercontent.com/u/1785686?v=3","gravatar_id":"","url":"https://api.github.com/users/dimsav","html_url":"https://github.com/dimsav","followers_url":"https://api.github.com/users/dimsav/followers","following_url":"https://api.github.com/users/dimsav/following{/other_user}","gists_url":"https://api.github.com/users/dimsav/gists{/gist_id}","starred_url":"https://api.github.com/users/dimsav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimsav/subscriptions","organizations_url":"https://api.github.com/users/dimsav/orgs","repos_url":"https://api.github.com/users/dimsav/repos","events_url":"https://api.github.com/users/dimsav/events{/privacy}","received_events_url":"https://api.github.com/users/dimsav/received_events","type":"User","site_admin":false},"body":"Please do the following changes:\r\n\r\n- make this method private. We want to reduce visibility as much as possible.\r\n- change the order of the arguments. Let $locale be first to match the order of the returned string.\r\n- rename $key to $attribute. Makes it more readable I think.\r\n\r\nWould you agree renaming this to `getLocalizedAttributeAsFillableKey()`?","created_at":"2015-11-27T11:36:10Z","updated_at":"2015-11-27T11:36:10Z","html_url":"https://github.com/dimsav/laravel-translatable/pull/184#discussion_r46039304","pull_request_url":"https://api.github.com/repos/dimsav/laravel-translatable/pulls/184","_links":{"self":{"href":"https://api.github.com/repos/dimsav/laravel-translatable/pulls/comments/46039304"},"html":{"href":"https://github.com/dimsav/laravel-translatable/pull/184#discussion_r46039304"},"pull_request":{"href":"https://api.github.com/repos/dimsav/laravel-translatable/pulls/184"}}},"pull_request":{"url":"https://api.github.com/repos/dimsav/laravel-translatable/pulls/184","id":51921827,"html_url":"https://github.com/dimsav/laravel-translatable/pull/184","diff_url":"https://github.com/dimsav/laravel-translatable/pull/184.diff","patch_url":"https://github.com/dimsav/laravel-translatable/pull/184.patch","issue_url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/184","number":184,"state":"open","locked":false,"title":"Add getFillable() method","user":{"login":"Propaganistas","id":6680176,"avatar_url":"https://avatars.githubusercontent.com/u/6680176?v=3","gravatar_id":"","url":"https://api.github.com/users/Propaganistas","html_url":"https://github.com/Propaganistas","followers_url":"https://api.github.com/users/Propaganistas/followers","following_url":"https://api.github.com/users/Propaganistas/following{/other_user}","gists_url":"https://api.github.com/users/Propaganistas/gists{/gist_id}","starred_url":"https://api.github.com/users/Propaganistas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Propaganistas/subscriptions","organizations_url":"https://api.github.com/users/Propaganistas/orgs","repos_url":"https://api.github.com/users/Propaganistas/repos","events_url":"https://api.github.com/users/Propaganistas/events{/privacy}","received_events_url":"https://api.github.com/users/Propaganistas/received_events","type":"User","site_admin":false},"body":"This PR adds translatable attributes to the `$fillable` list when requested through `getFillable()` (which is the recommended way to access the `$fillable` property.\r\n\r\nMoreover, this method is very handy to filter out unwanted request input by simply using `$request->only(Model::getFillable())`.\r\n\r\nBy implementing this PR, Laravel Translatable integrates even more gracefully in the fillable features of Eloquent.","created_at":"2015-11-26T15:01:32Z","updated_at":"2015-11-27T11:36:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b307d139e4d874fe7210812a88da5e5eed4f4e9e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dimsav/laravel-translatable/pulls/184/commits","review_comments_url":"https://api.github.com/repos/dimsav/laravel-translatable/pulls/184/comments","review_comment_url":"https://api.github.com/repos/dimsav/laravel-translatable/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/184/comments","statuses_url":"https://api.github.com/repos/dimsav/laravel-translatable/statuses/cab3d120a9e7ffaf8d01160aab2a8f49265c43cc","head":{"label":"Propaganistas:master","ref":"master","sha":"cab3d120a9e7ffaf8d01160aab2a8f49265c43cc","user":{"login":"Propaganistas","id":6680176,"avatar_url":"https://avatars.githubusercontent.com/u/6680176?v=3","gravatar_id":"","url":"https://api.github.com/users/Propaganistas","html_url":"https://github.com/Propaganistas","followers_url":"https://api.github.com/users/Propaganistas/followers","following_url":"https://api.github.com/users/Propaganistas/following{/other_user}","gists_url":"https://api.github.com/users/Propaganistas/gists{/gist_id}","starred_url":"https://api.github.com/users/Propaganistas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Propaganistas/subscriptions","organizations_url":"https://api.github.com/users/Propaganistas/orgs","repos_url":"https://api.github.com/users/Propaganistas/repos","events_url":"https://api.github.com/users/Propaganistas/events{/privacy}","received_events_url":"https://api.github.com/users/Propaganistas/received_events","type":"User","site_admin":false},"repo":{"id":46932734,"name":"laravel-translatable","full_name":"Propaganistas/laravel-translatable","owner":{"login":"Propaganistas","id":6680176,"avatar_url":"https://avatars.githubusercontent.com/u/6680176?v=3","gravatar_id":"","url":"https://api.github.com/users/Propaganistas","html_url":"https://github.com/Propaganistas","followers_url":"https://api.github.com/users/Propaganistas/followers","following_url":"https://api.github.com/users/Propaganistas/following{/other_user}","gists_url":"https://api.github.com/users/Propaganistas/gists{/gist_id}","starred_url":"https://api.github.com/users/Propaganistas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Propaganistas/subscriptions","organizations_url":"https://api.github.com/users/Propaganistas/orgs","repos_url":"https://api.github.com/users/Propaganistas/repos","events_url":"https://api.github.com/users/Propaganistas/events{/privacy}","received_events_url":"https://api.github.com/users/Propaganistas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Propaganistas/laravel-translatable","description":"A Laravel package for multilingual models","fork":true,"url":"https://api.github.com/repos/Propaganistas/laravel-translatable","forks_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/forks","keys_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/teams","hooks_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/hooks","issue_events_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/issues/events{/number}","events_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/events","assignees_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/assignees{/user}","branches_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/branches{/branch}","tags_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/tags","blobs_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/git/refs{/sha}","trees_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/statuses/{sha}","languages_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/languages","stargazers_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/stargazers","contributors_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/contributors","subscribers_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/subscribers","subscription_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/subscription","commits_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/commits{/sha}","git_commits_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/git/commits{/sha}","comments_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/comments{/number}","issue_comment_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/issues/comments{/number}","contents_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/contents/{+path}","compare_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/merges","archive_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/downloads","issues_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/issues{/number}","pulls_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/pulls{/number}","milestones_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/milestones{/number}","notifications_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/labels{/name}","releases_url":"https://api.github.com/repos/Propaganistas/laravel-translatable/releases{/id}","created_at":"2015-11-26T14:59:07Z","updated_at":"2015-11-26T14:59:08Z","pushed_at":"2015-11-27T06:49:14Z","git_url":"git://github.com/Propaganistas/laravel-translatable.git","ssh_url":"git@github.com:Propaganistas/laravel-translatable.git","clone_url":"https://github.com/Propaganistas/laravel-translatable.git","svn_url":"https://github.com/Propaganistas/laravel-translatable","homepage":null,"size":245,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dimsav:master","ref":"master","sha":"222d8ab86c7529e644bd819930e22ad9dd0527b1","user":{"login":"dimsav","id":1785686,"avatar_url":"https://avatars.githubusercontent.com/u/1785686?v=3","gravatar_id":"","url":"https://api.github.com/users/dimsav","html_url":"https://github.com/dimsav","followers_url":"https://api.github.com/users/dimsav/followers","following_url":"https://api.github.com/users/dimsav/following{/other_user}","gists_url":"https://api.github.com/users/dimsav/gists{/gist_id}","starred_url":"https://api.github.com/users/dimsav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimsav/subscriptions","organizations_url":"https://api.github.com/users/dimsav/orgs","repos_url":"https://api.github.com/users/dimsav/repos","events_url":"https://api.github.com/users/dimsav/events{/privacy}","received_events_url":"https://api.github.com/users/dimsav/received_events","type":"User","site_admin":false},"repo":{"id":16480576,"name":"laravel-translatable","full_name":"dimsav/laravel-translatable","owner":{"login":"dimsav","id":1785686,"avatar_url":"https://avatars.githubusercontent.com/u/1785686?v=3","gravatar_id":"","url":"https://api.github.com/users/dimsav","html_url":"https://github.com/dimsav","followers_url":"https://api.github.com/users/dimsav/followers","following_url":"https://api.github.com/users/dimsav/following{/other_user}","gists_url":"https://api.github.com/users/dimsav/gists{/gist_id}","starred_url":"https://api.github.com/users/dimsav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimsav/subscriptions","organizations_url":"https://api.github.com/users/dimsav/orgs","repos_url":"https://api.github.com/users/dimsav/repos","events_url":"https://api.github.com/users/dimsav/events{/privacy}","received_events_url":"https://api.github.com/users/dimsav/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dimsav/laravel-translatable","description":"A Laravel package for multilingual models","fork":false,"url":"https://api.github.com/repos/dimsav/laravel-translatable","forks_url":"https://api.github.com/repos/dimsav/laravel-translatable/forks","keys_url":"https://api.github.com/repos/dimsav/laravel-translatable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimsav/laravel-translatable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimsav/laravel-translatable/teams","hooks_url":"https://api.github.com/repos/dimsav/laravel-translatable/hooks","issue_events_url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/events{/number}","events_url":"https://api.github.com/repos/dimsav/laravel-translatable/events","assignees_url":"https://api.github.com/repos/dimsav/laravel-translatable/assignees{/user}","branches_url":"https://api.github.com/repos/dimsav/laravel-translatable/branches{/branch}","tags_url":"https://api.github.com/repos/dimsav/laravel-translatable/tags","blobs_url":"https://api.github.com/repos/dimsav/laravel-translatable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimsav/laravel-translatable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimsav/laravel-translatable/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimsav/laravel-translatable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimsav/laravel-translatable/statuses/{sha}","languages_url":"https://api.github.com/repos/dimsav/laravel-translatable/languages","stargazers_url":"https://api.github.com/repos/dimsav/laravel-translatable/stargazers","contributors_url":"https://api.github.com/repos/dimsav/laravel-translatable/contributors","subscribers_url":"https://api.github.com/repos/dimsav/laravel-translatable/subscribers","subscription_url":"https://api.github.com/repos/dimsav/laravel-translatable/subscription","commits_url":"https://api.github.com/repos/dimsav/laravel-translatable/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimsav/laravel-translatable/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimsav/laravel-translatable/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimsav/laravel-translatable/contents/{+path}","compare_url":"https://api.github.com/repos/dimsav/laravel-translatable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimsav/laravel-translatable/merges","archive_url":"https://api.github.com/repos/dimsav/laravel-translatable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimsav/laravel-translatable/downloads","issues_url":"https://api.github.com/repos/dimsav/laravel-translatable/issues{/number}","pulls_url":"https://api.github.com/repos/dimsav/laravel-translatable/pulls{/number}","milestones_url":"https://api.github.com/repos/dimsav/laravel-translatable/milestones{/number}","notifications_url":"https://api.github.com/repos/dimsav/laravel-translatable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimsav/laravel-translatable/labels{/name}","releases_url":"https://api.github.com/repos/dimsav/laravel-translatable/releases{/id}","created_at":"2014-02-03T13:45:13Z","updated_at":"2015-11-25T14:00:36Z","pushed_at":"2015-11-27T06:49:14Z","git_url":"git://github.com/dimsav/laravel-translatable.git","ssh_url":"git@github.com:dimsav/laravel-translatable.git","clone_url":"https://github.com/dimsav/laravel-translatable.git","svn_url":"https://github.com/dimsav/laravel-translatable","homepage":null,"size":1214,"stargazers_count":534,"watchers_count":534,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":89,"mirror_url":null,"open_issues_count":13,"forks":89,"open_issues":13,"watchers":534,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dimsav/laravel-translatable/pulls/184"},"html":{"href":"https://github.com/dimsav/laravel-translatable/pull/184"},"issue":{"href":"https://api.github.com/repos/dimsav/laravel-translatable/issues/184"},"comments":{"href":"https://api.github.com/repos/dimsav/laravel-translatable/issues/184/comments"},"review_comments":{"href":"https://api.github.com/repos/dimsav/laravel-translatable/pulls/184/comments"},"review_comment":{"href":"https://api.github.com/repos/dimsav/laravel-translatable/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dimsav/laravel-translatable/pulls/184/commits"},"statuses":{"href":"https://api.github.com/repos/dimsav/laravel-translatable/statuses/cab3d120a9e7ffaf8d01160aab2a8f49265c43cc"}}}}