{"action":"created","comment":{"url":"https://api.github.com/repos/spatie/laravel-binary-uuid/pulls/comments/208137943","pull_request_review_id":143885055,"id":208137943,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODEzNzk0Mw==","diff_hunk":"@@ -73,17 +73,90 @@ public static function decodeUuid(string $binaryUuid): string\n \n     public function toArray()\n     {\n-        if (! $this->exists) {\n-            return parent::toArray();\n+        $uuidAttributes = $this->getUuidAttributes();\n+\n+        $array = parent::toArray();\n+\n+        // if (! $this->exists) {\n+        // return $array;\n+        // }\n+\n+        if (is_array($uuidAttributes)) {\n+            foreach ($uuidAttributes as $attributeKey) {\n+                if (array_key_exists($attributeKey, $array)) {\n+                    $uuidKey = $this->getRelatedBinaryKeyName($attributeKey);\n+                    $array[$attributeKey] = $this->{$uuidKey};\n+                }\n+            }\n+        }\n+\n+        return $array;\n+    }\n+\n+    public function getRelatedBinaryKeyName($attrib)","path":"src/HasBinaryUuid.php","position":26,"original_position":26,"commit_id":"79ae0942c96a4edbd9d3fabba20db865e1c7b095","original_commit_id":"79ae0942c96a4edbd9d3fabba20db865e1c7b095","user":{"login":"brendt","id":6905297,"node_id":"MDQ6VXNlcjY5MDUyOTc=","avatar_url":"https://avatars3.githubusercontent.com/u/6905297?v=4","gravatar_id":"","url":"https://api.github.com/users/brendt","html_url":"https://github.com/brendt","followers_url":"https://api.github.com/users/brendt/followers","following_url":"https://api.github.com/users/brendt/following{/other_user}","gists_url":"https://api.github.com/users/brendt/gists{/gist_id}","starred_url":"https://api.github.com/users/brendt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendt/subscriptions","organizations_url":"https://api.github.com/users/brendt/orgs","repos_url":"https://api.github.com/users/brendt/repos","events_url":"https://api.github.com/users/brendt/events{/privacy}","received_events_url":"https://api.github.com/users/brendt/received_events","type":"User","site_admin":false},"body":"Use the full name `$attribute`, no need to use shortened names, they make things more confusing for people reading the code.","created_at":"2018-08-07T08:18:07Z","updated_at":"2018-08-07T08:38:54Z","html_url":"https://github.com/spatie/laravel-binary-uuid/pull/49#discussion_r208137943","pull_request_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/pulls/49","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/spatie/laravel-binary-uuid/pulls/comments/208137943"},"html":{"href":"https://github.com/spatie/laravel-binary-uuid/pull/49#discussion_r208137943"},"pull_request":{"href":"https://api.github.com/repos/spatie/laravel-binary-uuid/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/spatie/laravel-binary-uuid/pulls/49","id":206423729,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2NDIzNzI5","html_url":"https://github.com/spatie/laravel-binary-uuid/pull/49","diff_url":"https://github.com/spatie/laravel-binary-uuid/pull/49.diff","patch_url":"https://github.com/spatie/laravel-binary-uuid/pull/49.patch","issue_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/issues/49","number":49,"state":"open","locked":false,"title":"Adding dynamic accessors and mutators from $uuidAttributes and customising uuid text attribute suffix","user":{"login":"isocroft","id":5495952,"node_id":"MDQ6VXNlcjU0OTU5NTI=","avatar_url":"https://avatars0.githubusercontent.com/u/5495952?v=4","gravatar_id":"","url":"https://api.github.com/users/isocroft","html_url":"https://github.com/isocroft","followers_url":"https://api.github.com/users/isocroft/followers","following_url":"https://api.github.com/users/isocroft/following{/other_user}","gists_url":"https://api.github.com/users/isocroft/gists{/gist_id}","starred_url":"https://api.github.com/users/isocroft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isocroft/subscriptions","organizations_url":"https://api.github.com/users/isocroft/orgs","repos_url":"https://api.github.com/users/isocroft/repos","events_url":"https://api.github.com/users/isocroft/events{/privacy}","received_events_url":"https://api.github.com/users/isocroft/received_events","type":"User","site_admin":false},"body":"This PR references this [PR](https://github.com/spatie/laravel-binary-uuid/pull/35) by @westphalen and also this [issue](https://github.com/spatie/laravel-binary-uuid/issues/45) #45 and #33 . It also makes the default `uuid` text attribute suffix customizable with support for composite keys without breaking original code. Details are on `README.md` file on this PR branch.\r\n\r\nThanks in anticipation.","created_at":"2018-08-06T14:50:00Z","updated_at":"2018-08-07T08:38:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4581db89c6d7be77917ebfdf79199519a17caa62","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/pulls/49/commits","review_comments_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/pulls/49/comments","review_comment_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/issues/49/comments","statuses_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/statuses/79ae0942c96a4edbd9d3fabba20db865e1c7b095","head":{"label":"isocroft:dynamic_accessors_mutators","ref":"dynamic_accessors_mutators","sha":"79ae0942c96a4edbd9d3fabba20db865e1c7b095","user":{"login":"isocroft","id":5495952,"node_id":"MDQ6VXNlcjU0OTU5NTI=","avatar_url":"https://avatars0.githubusercontent.com/u/5495952?v=4","gravatar_id":"","url":"https://api.github.com/users/isocroft","html_url":"https://github.com/isocroft","followers_url":"https://api.github.com/users/isocroft/followers","following_url":"https://api.github.com/users/isocroft/following{/other_user}","gists_url":"https://api.github.com/users/isocroft/gists{/gist_id}","starred_url":"https://api.github.com/users/isocroft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isocroft/subscriptions","organizations_url":"https://api.github.com/users/isocroft/orgs","repos_url":"https://api.github.com/users/isocroft/repos","events_url":"https://api.github.com/users/isocroft/events{/privacy}","received_events_url":"https://api.github.com/users/isocroft/received_events","type":"User","site_admin":false},"repo":{"id":143723467,"node_id":"MDEwOlJlcG9zaXRvcnkxNDM3MjM0Njc=","name":"laravel-binary-uuid","full_name":"isocroft/laravel-binary-uuid","owner":{"login":"isocroft","id":5495952,"node_id":"MDQ6VXNlcjU0OTU5NTI=","avatar_url":"https://avatars0.githubusercontent.com/u/5495952?v=4","gravatar_id":"","url":"https://api.github.com/users/isocroft","html_url":"https://github.com/isocroft","followers_url":"https://api.github.com/users/isocroft/followers","following_url":"https://api.github.com/users/isocroft/following{/other_user}","gists_url":"https://api.github.com/users/isocroft/gists{/gist_id}","starred_url":"https://api.github.com/users/isocroft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isocroft/subscriptions","organizations_url":"https://api.github.com/users/isocroft/orgs","repos_url":"https://api.github.com/users/isocroft/repos","events_url":"https://api.github.com/users/isocroft/events{/privacy}","received_events_url":"https://api.github.com/users/isocroft/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/isocroft/laravel-binary-uuid","description":"Optimised binary UUIDs in Laravel","fork":true,"url":"https://api.github.com/repos/isocroft/laravel-binary-uuid","forks_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/forks","keys_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/teams","hooks_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/hooks","issue_events_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/issues/events{/number}","events_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/events","assignees_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/assignees{/user}","branches_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/branches{/branch}","tags_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/tags","blobs_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/git/refs{/sha}","trees_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/statuses/{sha}","languages_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/languages","stargazers_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/stargazers","contributors_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/contributors","subscribers_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/subscribers","subscription_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/subscription","commits_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/commits{/sha}","git_commits_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/git/commits{/sha}","comments_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/comments{/number}","issue_comment_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/issues/comments{/number}","contents_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/contents/{+path}","compare_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/merges","archive_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/downloads","issues_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/issues{/number}","pulls_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/pulls{/number}","milestones_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/milestones{/number}","notifications_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/labels{/name}","releases_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/releases{/id}","deployments_url":"https://api.github.com/repos/isocroft/laravel-binary-uuid/deployments","created_at":"2018-08-06T12:11:00Z","updated_at":"2018-08-06T12:11:02Z","pushed_at":"2018-08-06T17:08:42Z","git_url":"git://github.com/isocroft/laravel-binary-uuid.git","ssh_url":"git@github.com:isocroft/laravel-binary-uuid.git","clone_url":"https://github.com/isocroft/laravel-binary-uuid.git","svn_url":"https://github.com/isocroft/laravel-binary-uuid","homepage":"https://spatie.be/en/opensource/laravel","size":290,"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","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"spatie:master","ref":"master","sha":"2bdada2068d87c348af511cdd84f2ca4959d2b15","user":{"login":"spatie","id":7535935,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc1MzU5MzU=","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":110949385,"node_id":"MDEwOlJlcG9zaXRvcnkxMTA5NDkzODU=","name":"laravel-binary-uuid","full_name":"spatie/laravel-binary-uuid","owner":{"login":"spatie","id":7535935,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc1MzU5MzU=","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-binary-uuid","description":"Optimised binary UUIDs in Laravel","fork":false,"url":"https://api.github.com/repos/spatie/laravel-binary-uuid","forks_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/forks","keys_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/teams","hooks_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/hooks","issue_events_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/issues/events{/number}","events_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/events","assignees_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/assignees{/user}","branches_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/branches{/branch}","tags_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/tags","blobs_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/git/refs{/sha}","trees_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/statuses/{sha}","languages_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/languages","stargazers_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/stargazers","contributors_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/contributors","subscribers_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/subscribers","subscription_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/subscription","commits_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/commits{/sha}","git_commits_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/git/commits{/sha}","comments_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/comments{/number}","issue_comment_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/issues/comments{/number}","contents_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/contents/{+path}","compare_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/merges","archive_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/downloads","issues_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/issues{/number}","pulls_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/pulls{/number}","milestones_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/milestones{/number}","notifications_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/labels{/name}","releases_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/releases{/id}","deployments_url":"https://api.github.com/repos/spatie/laravel-binary-uuid/deployments","created_at":"2017-11-16T09:12:18Z","updated_at":"2018-08-07T06:27:02Z","pushed_at":"2018-08-06T17:08:44Z","git_url":"git://github.com/spatie/laravel-binary-uuid.git","ssh_url":"git@github.com:spatie/laravel-binary-uuid.git","clone_url":"https://github.com/spatie/laravel-binary-uuid.git","svn_url":"https://github.com/spatie/laravel-binary-uuid","homepage":"https://spatie.be/en/opensource/laravel","size":260,"stargazers_count":432,"watchers_count":432,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":24,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":24,"open_issues":5,"watchers":432,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spatie/laravel-binary-uuid/pulls/49"},"html":{"href":"https://github.com/spatie/laravel-binary-uuid/pull/49"},"issue":{"href":"https://api.github.com/repos/spatie/laravel-binary-uuid/issues/49"},"comments":{"href":"https://api.github.com/repos/spatie/laravel-binary-uuid/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/spatie/laravel-binary-uuid/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/spatie/laravel-binary-uuid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spatie/laravel-binary-uuid/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/spatie/laravel-binary-uuid/statuses/79ae0942c96a4edbd9d3fabba20db865e1c7b095"}},"author_association":"NONE"}}
{"actor":{"display_login":"brendt"}}