{"action":"opened","number":26992,"pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/26992","id":241447876,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQxNDQ3ODc2","html_url":"https://github.com/laravel/framework/pull/26992","diff_url":"https://github.com/laravel/framework/pull/26992.diff","patch_url":"https://github.com/laravel/framework/pull/26992.patch","issue_url":"https://api.github.com/repos/laravel/framework/issues/26992","number":26992,"state":"open","locked":false,"title":"[5.7] Prevent unnecessary relationship queries","user":{"login":"staudenmeir","id":1853169,"node_id":"MDQ6VXNlcjE4NTMxNjk=","avatar_url":"https://avatars3.githubusercontent.com/u/1853169?v=4","gravatar_id":"","url":"https://api.github.com/users/staudenmeir","html_url":"https://github.com/staudenmeir","followers_url":"https://api.github.com/users/staudenmeir/followers","following_url":"https://api.github.com/users/staudenmeir/following{/other_user}","gists_url":"https://api.github.com/users/staudenmeir/gists{/gist_id}","starred_url":"https://api.github.com/users/staudenmeir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/staudenmeir/subscriptions","organizations_url":"https://api.github.com/users/staudenmeir/orgs","repos_url":"https://api.github.com/users/staudenmeir/repos","events_url":"https://api.github.com/users/staudenmeir/events{/privacy}","received_events_url":"https://api.github.com/users/staudenmeir/received_events","type":"User","site_admin":false},"body":"Prevents unnecessary queries when lazy loading empty relationships:\r\n\r\n```php\r\n(new Post(['user_id' => null]))->user; // null\r\n(new User)->posts;                     // []\r\n```\r\n\r\n`MorphTo::getResults()` is now handled by `BelongsTo::getResults()` (#8586).\r\n\r\nThis does *not* apply to custom relationship queries like `(new User)->posts()->get()`.\r\n\r\nI don't think we need additional tests for this. There are plenty of tests that verify relationship queries.\r\n\r\nFixes #25214, #24241, #20616 and https://github.com/laravel/ideas/issues/748.","created_at":"2018-12-29T13:52:44Z","updated_at":"2018-12-29T13:52:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/laravel/framework/pulls/26992/commits","review_comments_url":"https://api.github.com/repos/laravel/framework/pulls/26992/comments","review_comment_url":"https://api.github.com/repos/laravel/framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/laravel/framework/issues/26992/comments","statuses_url":"https://api.github.com/repos/laravel/framework/statuses/3fc9d0ca5dbf184c601ef16f45b862f7ecde5d42","head":{"label":"staudenmeir:relation-queries","ref":"relation-queries","sha":"3fc9d0ca5dbf184c601ef16f45b862f7ecde5d42","user":{"login":"staudenmeir","id":1853169,"node_id":"MDQ6VXNlcjE4NTMxNjk=","avatar_url":"https://avatars3.githubusercontent.com/u/1853169?v=4","gravatar_id":"","url":"https://api.github.com/users/staudenmeir","html_url":"https://github.com/staudenmeir","followers_url":"https://api.github.com/users/staudenmeir/followers","following_url":"https://api.github.com/users/staudenmeir/following{/other_user}","gists_url":"https://api.github.com/users/staudenmeir/gists{/gist_id}","starred_url":"https://api.github.com/users/staudenmeir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/staudenmeir/subscriptions","organizations_url":"https://api.github.com/users/staudenmeir/orgs","repos_url":"https://api.github.com/users/staudenmeir/repos","events_url":"https://api.github.com/users/staudenmeir/events{/privacy}","received_events_url":"https://api.github.com/users/staudenmeir/received_events","type":"User","site_admin":false},"repo":{"id":133823656,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM4MjM2NTY=","name":"framework","full_name":"staudenmeir/framework","private":false,"owner":{"login":"staudenmeir","id":1853169,"node_id":"MDQ6VXNlcjE4NTMxNjk=","avatar_url":"https://avatars3.githubusercontent.com/u/1853169?v=4","gravatar_id":"","url":"https://api.github.com/users/staudenmeir","html_url":"https://github.com/staudenmeir","followers_url":"https://api.github.com/users/staudenmeir/followers","following_url":"https://api.github.com/users/staudenmeir/following{/other_user}","gists_url":"https://api.github.com/users/staudenmeir/gists{/gist_id}","starred_url":"https://api.github.com/users/staudenmeir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/staudenmeir/subscriptions","organizations_url":"https://api.github.com/users/staudenmeir/orgs","repos_url":"https://api.github.com/users/staudenmeir/repos","events_url":"https://api.github.com/users/staudenmeir/events{/privacy}","received_events_url":"https://api.github.com/users/staudenmeir/received_events","type":"User","site_admin":false},"html_url":"https://github.com/staudenmeir/framework","description":null,"fork":true,"url":"https://api.github.com/repos/staudenmeir/framework","forks_url":"https://api.github.com/repos/staudenmeir/framework/forks","keys_url":"https://api.github.com/repos/staudenmeir/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/staudenmeir/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/staudenmeir/framework/teams","hooks_url":"https://api.github.com/repos/staudenmeir/framework/hooks","issue_events_url":"https://api.github.com/repos/staudenmeir/framework/issues/events{/number}","events_url":"https://api.github.com/repos/staudenmeir/framework/events","assignees_url":"https://api.github.com/repos/staudenmeir/framework/assignees{/user}","branches_url":"https://api.github.com/repos/staudenmeir/framework/branches{/branch}","tags_url":"https://api.github.com/repos/staudenmeir/framework/tags","blobs_url":"https://api.github.com/repos/staudenmeir/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/staudenmeir/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/staudenmeir/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/staudenmeir/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/staudenmeir/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/staudenmeir/framework/languages","stargazers_url":"https://api.github.com/repos/staudenmeir/framework/stargazers","contributors_url":"https://api.github.com/repos/staudenmeir/framework/contributors","subscribers_url":"https://api.github.com/repos/staudenmeir/framework/subscribers","subscription_url":"https://api.github.com/repos/staudenmeir/framework/subscription","commits_url":"https://api.github.com/repos/staudenmeir/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/staudenmeir/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/staudenmeir/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/staudenmeir/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/staudenmeir/framework/contents/{+path}","compare_url":"https://api.github.com/repos/staudenmeir/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/staudenmeir/framework/merges","archive_url":"https://api.github.com/repos/staudenmeir/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/staudenmeir/framework/downloads","issues_url":"https://api.github.com/repos/staudenmeir/framework/issues{/number}","pulls_url":"https://api.github.com/repos/staudenmeir/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/staudenmeir/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/staudenmeir/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/staudenmeir/framework/labels{/name}","releases_url":"https://api.github.com/repos/staudenmeir/framework/releases{/id}","deployments_url":"https://api.github.com/repos/staudenmeir/framework/deployments","created_at":"2018-05-17T14:15:43Z","updated_at":"2018-12-29T10:31:19Z","pushed_at":"2018-12-29T12:57:47Z","git_url":"git://github.com/staudenmeir/framework.git","ssh_url":"git@github.com:staudenmeir/framework.git","clone_url":"https://github.com/staudenmeir/framework.git","svn_url":"https://github.com/staudenmeir/framework","homepage":"http://laravel.com","size":38091,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"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":"5.7"}},"base":{"label":"laravel:5.7","ref":"5.7","sha":"9db6d0d98ada44e1aa407c914c7f5351d6e1715d","user":{"login":"laravel","id":958072,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk1ODA3Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/958072?v=4","gravatar_id":"","url":"https://api.github.com/users/laravel","html_url":"https://github.com/laravel","followers_url":"https://api.github.com/users/laravel/followers","following_url":"https://api.github.com/users/laravel/following{/other_user}","gists_url":"https://api.github.com/users/laravel/gists{/gist_id}","starred_url":"https://api.github.com/users/laravel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laravel/subscriptions","organizations_url":"https://api.github.com/users/laravel/orgs","repos_url":"https://api.github.com/users/laravel/repos","events_url":"https://api.github.com/users/laravel/events{/privacy}","received_events_url":"https://api.github.com/users/laravel/received_events","type":"Organization","site_admin":false},"repo":{"id":7548986,"node_id":"MDEwOlJlcG9zaXRvcnk3NTQ4OTg2","name":"framework","full_name":"laravel/framework","private":false,"owner":{"login":"laravel","id":958072,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk1ODA3Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/958072?v=4","gravatar_id":"","url":"https://api.github.com/users/laravel","html_url":"https://github.com/laravel","followers_url":"https://api.github.com/users/laravel/followers","following_url":"https://api.github.com/users/laravel/following{/other_user}","gists_url":"https://api.github.com/users/laravel/gists{/gist_id}","starred_url":"https://api.github.com/users/laravel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laravel/subscriptions","organizations_url":"https://api.github.com/users/laravel/orgs","repos_url":"https://api.github.com/users/laravel/repos","events_url":"https://api.github.com/users/laravel/events{/privacy}","received_events_url":"https://api.github.com/users/laravel/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/laravel/framework","description":null,"fork":false,"url":"https://api.github.com/repos/laravel/framework","forks_url":"https://api.github.com/repos/laravel/framework/forks","keys_url":"https://api.github.com/repos/laravel/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/laravel/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/laravel/framework/teams","hooks_url":"https://api.github.com/repos/laravel/framework/hooks","issue_events_url":"https://api.github.com/repos/laravel/framework/issues/events{/number}","events_url":"https://api.github.com/repos/laravel/framework/events","assignees_url":"https://api.github.com/repos/laravel/framework/assignees{/user}","branches_url":"https://api.github.com/repos/laravel/framework/branches{/branch}","tags_url":"https://api.github.com/repos/laravel/framework/tags","blobs_url":"https://api.github.com/repos/laravel/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/laravel/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/laravel/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/laravel/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/laravel/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/laravel/framework/languages","stargazers_url":"https://api.github.com/repos/laravel/framework/stargazers","contributors_url":"https://api.github.com/repos/laravel/framework/contributors","subscribers_url":"https://api.github.com/repos/laravel/framework/subscribers","subscription_url":"https://api.github.com/repos/laravel/framework/subscription","commits_url":"https://api.github.com/repos/laravel/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/laravel/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/laravel/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/laravel/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/laravel/framework/contents/{+path}","compare_url":"https://api.github.com/repos/laravel/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/laravel/framework/merges","archive_url":"https://api.github.com/repos/laravel/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/laravel/framework/downloads","issues_url":"https://api.github.com/repos/laravel/framework/issues{/number}","pulls_url":"https://api.github.com/repos/laravel/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/laravel/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/laravel/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/laravel/framework/labels{/name}","releases_url":"https://api.github.com/repos/laravel/framework/releases{/id}","deployments_url":"https://api.github.com/repos/laravel/framework/deployments","created_at":"2013-01-10T21:27:28Z","updated_at":"2018-12-29T13:32:25Z","pushed_at":"2018-12-29T13:26:18Z","git_url":"git://github.com/laravel/framework.git","ssh_url":"git@github.com:laravel/framework.git","clone_url":"https://github.com/laravel/framework.git","svn_url":"https://github.com/laravel/framework","homepage":"http://laravel.com","size":38090,"stargazers_count":15424,"watchers_count":15424,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6133,"mirror_url":null,"archived":false,"open_issues_count":84,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":6133,"open_issues":84,"watchers":15424,"default_branch":"5.7"}},"_links":{"self":{"href":"https://api.github.com/repos/laravel/framework/pulls/26992"},"html":{"href":"https://github.com/laravel/framework/pull/26992"},"issue":{"href":"https://api.github.com/repos/laravel/framework/issues/26992"},"comments":{"href":"https://api.github.com/repos/laravel/framework/issues/26992/comments"},"review_comments":{"href":"https://api.github.com/repos/laravel/framework/pulls/26992/comments"},"review_comment":{"href":"https://api.github.com/repos/laravel/framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/laravel/framework/pulls/26992/commits"},"statuses":{"href":"https://api.github.com/repos/laravel/framework/statuses/3fc9d0ca5dbf184c601ef16f45b862f7ecde5d42"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":24,"deletions":17,"changed_files":8}}
{"actor":{"display_login":"staudenmeir"}}