{"action":"created","comment":{"url":"https://api.github.com/repos/spatie/laravel-translatable/pulls/comments/173123391","pull_request_review_id":102251163,"id":173123391,"diff_hunk":"@@ -91,6 +91,18 @@ public function getTranslations($key) : array\n         return json_decode($this->getAttributes()[$key] ?? '' ?: '{}', true) ?: [];\n     }\n \n+    public function getAllTranslations() : array\n+    {\n+        $translations = [];\n+\n+        foreach ($this->getTranslatableAttributes() as $attribute) {\n+            $this->guardAgainstUntranslatableAttribute($attribute);\n+            $translations[$attribute] = json_decode($this->getAttributes()[$attribute] ?? '' ?: '{}') ?: [];","path":"src/HasTranslations.php","position":10,"original_position":10,"commit_id":"41d0d1a3728fe8060cc87ac6dfaa82281bf855d3","original_commit_id":"41d0d1a3728fe8060cc87ac6dfaa82281bf855d3","user":{"login":"freekmurze","id":483853,"avatar_url":"https://avatars2.githubusercontent.com/u/483853?v=4","gravatar_id":"","url":"https://api.github.com/users/freekmurze","html_url":"https://github.com/freekmurze","followers_url":"https://api.github.com/users/freekmurze/followers","following_url":"https://api.github.com/users/freekmurze/following{/other_user}","gists_url":"https://api.github.com/users/freekmurze/gists{/gist_id}","starred_url":"https://api.github.com/users/freekmurze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freekmurze/subscriptions","organizations_url":"https://api.github.com/users/freekmurze/orgs","repos_url":"https://api.github.com/users/freekmurze/repos","events_url":"https://api.github.com/users/freekmurze/events{/privacy}","received_events_url":"https://api.github.com/users/freekmurze/received_events","type":"User","site_admin":false},"body":"Couldn't we just use `getTranslations` here?","created_at":"2018-03-08T10:46:19Z","updated_at":"2018-03-08T10:47:06Z","html_url":"https://github.com/spatie/laravel-translatable/pull/108#discussion_r173123391","pull_request_url":"https://api.github.com/repos/spatie/laravel-translatable/pulls/108","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/spatie/laravel-translatable/pulls/comments/173123391"},"html":{"href":"https://github.com/spatie/laravel-translatable/pull/108#discussion_r173123391"},"pull_request":{"href":"https://api.github.com/repos/spatie/laravel-translatable/pulls/108"}}},"pull_request":{"url":"https://api.github.com/repos/spatie/laravel-translatable/pulls/108","id":173590202,"html_url":"https://github.com/spatie/laravel-translatable/pull/108","diff_url":"https://github.com/spatie/laravel-translatable/pull/108.diff","patch_url":"https://github.com/spatie/laravel-translatable/pull/108.patch","issue_url":"https://api.github.com/repos/spatie/laravel-translatable/issues/108","number":108,"state":"open","locked":false,"title":"Add getAllTranslations()","user":{"login":"nateritter","id":198798,"avatar_url":"https://avatars0.githubusercontent.com/u/198798?v=4","gravatar_id":"","url":"https://api.github.com/users/nateritter","html_url":"https://github.com/nateritter","followers_url":"https://api.github.com/users/nateritter/followers","following_url":"https://api.github.com/users/nateritter/following{/other_user}","gists_url":"https://api.github.com/users/nateritter/gists{/gist_id}","starred_url":"https://api.github.com/users/nateritter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nateritter/subscriptions","organizations_url":"https://api.github.com/users/nateritter/orgs","repos_url":"https://api.github.com/users/nateritter/repos","events_url":"https://api.github.com/users/nateritter/events{/privacy}","received_events_url":"https://api.github.com/users/nateritter/received_events","type":"User","site_admin":false},"body":"Added a method called `getAllTranslations` to return every translatable field and the possible values. This is valuable because when creating a UI to edit translations, having each language and all it's values returned at the same time is much easier to deal with than looping and requesting each attribute/key and language that's being used.","created_at":"2018-03-07T22:19:53Z","updated_at":"2018-03-08T10:47:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"82800c2b733df29916fb18b8c0cf773c48636dd3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/spatie/laravel-translatable/pulls/108/commits","review_comments_url":"https://api.github.com/repos/spatie/laravel-translatable/pulls/108/comments","review_comment_url":"https://api.github.com/repos/spatie/laravel-translatable/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spatie/laravel-translatable/issues/108/comments","statuses_url":"https://api.github.com/repos/spatie/laravel-translatable/statuses/41d0d1a3728fe8060cc87ac6dfaa82281bf855d3","head":{"label":"Hotels4Hope:allTranslations","ref":"allTranslations","sha":"41d0d1a3728fe8060cc87ac6dfaa82281bf855d3","user":{"login":"Hotels4Hope","id":36006207,"avatar_url":"https://avatars1.githubusercontent.com/u/36006207?v=4","gravatar_id":"","url":"https://api.github.com/users/Hotels4Hope","html_url":"https://github.com/Hotels4Hope","followers_url":"https://api.github.com/users/Hotels4Hope/followers","following_url":"https://api.github.com/users/Hotels4Hope/following{/other_user}","gists_url":"https://api.github.com/users/Hotels4Hope/gists{/gist_id}","starred_url":"https://api.github.com/users/Hotels4Hope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hotels4Hope/subscriptions","organizations_url":"https://api.github.com/users/Hotels4Hope/orgs","repos_url":"https://api.github.com/users/Hotels4Hope/repos","events_url":"https://api.github.com/users/Hotels4Hope/events{/privacy}","received_events_url":"https://api.github.com/users/Hotels4Hope/received_events","type":"Organization","site_admin":false},"repo":{"id":124265415,"name":"laravel-translatable","full_name":"Hotels4Hope/laravel-translatable","owner":{"login":"Hotels4Hope","id":36006207,"avatar_url":"https://avatars1.githubusercontent.com/u/36006207?v=4","gravatar_id":"","url":"https://api.github.com/users/Hotels4Hope","html_url":"https://github.com/Hotels4Hope","followers_url":"https://api.github.com/users/Hotels4Hope/followers","following_url":"https://api.github.com/users/Hotels4Hope/following{/other_user}","gists_url":"https://api.github.com/users/Hotels4Hope/gists{/gist_id}","starred_url":"https://api.github.com/users/Hotels4Hope/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hotels4Hope/subscriptions","organizations_url":"https://api.github.com/users/Hotels4Hope/orgs","repos_url":"https://api.github.com/users/Hotels4Hope/repos","events_url":"https://api.github.com/users/Hotels4Hope/events{/privacy}","received_events_url":"https://api.github.com/users/Hotels4Hope/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Hotels4Hope/laravel-translatable","description":"Making Eloquent models translatable","fork":true,"url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable","forks_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/forks","keys_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/teams","hooks_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/hooks","issue_events_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/issues/events{/number}","events_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/events","assignees_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/assignees{/user}","branches_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/branches{/branch}","tags_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/tags","blobs_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/git/refs{/sha}","trees_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/statuses/{sha}","languages_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/languages","stargazers_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/stargazers","contributors_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/contributors","subscribers_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/subscribers","subscription_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/subscription","commits_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/commits{/sha}","git_commits_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/git/commits{/sha}","comments_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/comments{/number}","issue_comment_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/issues/comments{/number}","contents_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/contents/{+path}","compare_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/merges","archive_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/downloads","issues_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/issues{/number}","pulls_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/pulls{/number}","milestones_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/milestones{/number}","notifications_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/labels{/name}","releases_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/releases{/id}","deployments_url":"https://api.github.com/repos/Hotels4Hope/laravel-translatable/deployments","created_at":"2018-03-07T16:44:34Z","updated_at":"2018-03-07T16:44:36Z","pushed_at":"2018-03-07T22:26:58Z","git_url":"git://github.com/Hotels4Hope/laravel-translatable.git","ssh_url":"git@github.com:Hotels4Hope/laravel-translatable.git","clone_url":"https://github.com/Hotels4Hope/laravel-translatable.git","svn_url":"https://github.com/Hotels4Hope/laravel-translatable","homepage":"https://murze.be/2016/04/making-eloquent-models-translatable/","size":104,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"spatie:master","ref":"master","sha":"cef0aca31878994320353392cdf84a7a32d3886a","user":{"login":"spatie","id":7535935,"avatar_url":"https://avatars0.githubusercontent.com/u/7535935?v=4","gravatar_id":"","url":"https://api.github.com/users/spatie","html_url":"https://github.com/spatie","followers_url":"https://api.github.com/users/spatie/followers","following_url":"https://api.github.com/users/spatie/following{/other_user}","gists_url":"https://api.github.com/users/spatie/gists{/gist_id}","starred_url":"https://api.github.com/users/spatie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spatie/subscriptions","organizations_url":"https://api.github.com/users/spatie/orgs","repos_url":"https://api.github.com/users/spatie/repos","events_url":"https://api.github.com/users/spatie/events{/privacy}","received_events_url":"https://api.github.com/users/spatie/received_events","type":"Organization","site_admin":false},"repo":{"id":55690447,"name":"laravel-translatable","full_name":"spatie/laravel-translatable","owner":{"login":"spatie","id":7535935,"avatar_url":"https://avatars0.githubusercontent.com/u/7535935?v=4","gravatar_id":"","url":"https://api.github.com/users/spatie","html_url":"https://github.com/spatie","followers_url":"https://api.github.com/users/spatie/followers","following_url":"https://api.github.com/users/spatie/following{/other_user}","gists_url":"https://api.github.com/users/spatie/gists{/gist_id}","starred_url":"https://api.github.com/users/spatie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spatie/subscriptions","organizations_url":"https://api.github.com/users/spatie/orgs","repos_url":"https://api.github.com/users/spatie/repos","events_url":"https://api.github.com/users/spatie/events{/privacy}","received_events_url":"https://api.github.com/users/spatie/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spatie/laravel-translatable","description":"Making Eloquent models translatable","fork":false,"url":"https://api.github.com/repos/spatie/laravel-translatable","forks_url":"https://api.github.com/repos/spatie/laravel-translatable/forks","keys_url":"https://api.github.com/repos/spatie/laravel-translatable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spatie/laravel-translatable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spatie/laravel-translatable/teams","hooks_url":"https://api.github.com/repos/spatie/laravel-translatable/hooks","issue_events_url":"https://api.github.com/repos/spatie/laravel-translatable/issues/events{/number}","events_url":"https://api.github.com/repos/spatie/laravel-translatable/events","assignees_url":"https://api.github.com/repos/spatie/laravel-translatable/assignees{/user}","branches_url":"https://api.github.com/repos/spatie/laravel-translatable/branches{/branch}","tags_url":"https://api.github.com/repos/spatie/laravel-translatable/tags","blobs_url":"https://api.github.com/repos/spatie/laravel-translatable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spatie/laravel-translatable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spatie/laravel-translatable/git/refs{/sha}","trees_url":"https://api.github.com/repos/spatie/laravel-translatable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spatie/laravel-translatable/statuses/{sha}","languages_url":"https://api.github.com/repos/spatie/laravel-translatable/languages","stargazers_url":"https://api.github.com/repos/spatie/laravel-translatable/stargazers","contributors_url":"https://api.github.com/repos/spatie/laravel-translatable/contributors","subscribers_url":"https://api.github.com/repos/spatie/laravel-translatable/subscribers","subscription_url":"https://api.github.com/repos/spatie/laravel-translatable/subscription","commits_url":"https://api.github.com/repos/spatie/laravel-translatable/commits{/sha}","git_commits_url":"https://api.github.com/repos/spatie/laravel-translatable/git/commits{/sha}","comments_url":"https://api.github.com/repos/spatie/laravel-translatable/comments{/number}","issue_comment_url":"https://api.github.com/repos/spatie/laravel-translatable/issues/comments{/number}","contents_url":"https://api.github.com/repos/spatie/laravel-translatable/contents/{+path}","compare_url":"https://api.github.com/repos/spatie/laravel-translatable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spatie/laravel-translatable/merges","archive_url":"https://api.github.com/repos/spatie/laravel-translatable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spatie/laravel-translatable/downloads","issues_url":"https://api.github.com/repos/spatie/laravel-translatable/issues{/number}","pulls_url":"https://api.github.com/repos/spatie/laravel-translatable/pulls{/number}","milestones_url":"https://api.github.com/repos/spatie/laravel-translatable/milestones{/number}","notifications_url":"https://api.github.com/repos/spatie/laravel-translatable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spatie/laravel-translatable/labels{/name}","releases_url":"https://api.github.com/repos/spatie/laravel-translatable/releases{/id}","deployments_url":"https://api.github.com/repos/spatie/laravel-translatable/deployments","created_at":"2016-04-07T11:49:51Z","updated_at":"2018-03-07T15:49:49Z","pushed_at":"2018-03-07T22:26:59Z","git_url":"git://github.com/spatie/laravel-translatable.git","ssh_url":"git@github.com:spatie/laravel-translatable.git","clone_url":"https://github.com/spatie/laravel-translatable.git","svn_url":"https://github.com/spatie/laravel-translatable","homepage":"https://murze.be/2016/04/making-eloquent-models-translatable/","size":96,"stargazers_count":458,"watchers_count":458,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":74,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":74,"open_issues":3,"watchers":458,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spatie/laravel-translatable/pulls/108"},"html":{"href":"https://github.com/spatie/laravel-translatable/pull/108"},"issue":{"href":"https://api.github.com/repos/spatie/laravel-translatable/issues/108"},"comments":{"href":"https://api.github.com/repos/spatie/laravel-translatable/issues/108/comments"},"review_comments":{"href":"https://api.github.com/repos/spatie/laravel-translatable/pulls/108/comments"},"review_comment":{"href":"https://api.github.com/repos/spatie/laravel-translatable/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spatie/laravel-translatable/pulls/108/commits"},"statuses":{"href":"https://api.github.com/repos/spatie/laravel-translatable/statuses/41d0d1a3728fe8060cc87ac6dfaa82281bf855d3"}},"author_association":"NONE"}}
{"actor":{"display_login":"freekmurze"}}