{"action":"opened","number":24421,"pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/24421","id":192201441,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyMjAxNDQx","html_url":"https://github.com/laravel/framework/pull/24421","diff_url":"https://github.com/laravel/framework/pull/24421.diff","patch_url":"https://github.com/laravel/framework/pull/24421.patch","issue_url":"https://api.github.com/repos/laravel/framework/issues/24421","number":24421,"state":"open","locked":false,"title":"Improve collections customization","user":{"login":"dmitrybubyakin","id":11477505,"node_id":"MDQ6VXNlcjExNDc3NTA1","avatar_url":"https://avatars2.githubusercontent.com/u/11477505?v=4","gravatar_id":"","url":"https://api.github.com/users/dmitrybubyakin","html_url":"https://github.com/dmitrybubyakin","followers_url":"https://api.github.com/users/dmitrybubyakin/followers","following_url":"https://api.github.com/users/dmitrybubyakin/following{/other_user}","gists_url":"https://api.github.com/users/dmitrybubyakin/gists{/gist_id}","starred_url":"https://api.github.com/users/dmitrybubyakin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmitrybubyakin/subscriptions","organizations_url":"https://api.github.com/users/dmitrybubyakin/orgs","repos_url":"https://api.github.com/users/dmitrybubyakin/repos","events_url":"https://api.github.com/users/dmitrybubyakin/events{/privacy}","received_events_url":"https://api.github.com/users/dmitrybubyakin/received_events","type":"User","site_admin":false},"body":"This PR adds functionality for improving collections customization.\r\n\r\n```php\r\nclass MyCollection extends Collection\r\n{\r\n    public $meta;\r\n\r\n    public function __construct($items, string $meta) // $meta is required\r\n    {\r\n        parent::__construct($items);\r\n\r\n        $this->meta = $meta;\r\n    }\r\n}\r\n\r\n$myCollection = new MyCollection([1, 2, null, 4], 'Meta');\r\n$myCollection = $myCollection->filter(); // throws an exception, because of `new static(...)` called in the Collection::filter\r\n// Too few arguments to function MyCollection::__construct() 1 passed in Illuminate/Support/Collection.php on line 474 and exactly 2 expected\r\n```\r\n\r\nThis PR adds the `Collection::newInstance` method and allows to extend it in our collection class:\r\n\r\n```php\r\nclass MyCollection extends Collection\r\n{\r\n    // ...\r\n    protected function newInstance($items = [])\r\n    {\r\n        return new static($items, $this->meta);\r\n    }\r\n}\r\n\r\n$myCollection = new MyCollection([1, 2, null, 4], 'Meta');\r\n$myCollection = $myCollection->filter(); // everything ok\r\n```","created_at":"2018-06-02T14:48:30Z","updated_at":"2018-06-02T14:48:30Z","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/24421/commits","review_comments_url":"https://api.github.com/repos/laravel/framework/pulls/24421/comments","review_comment_url":"https://api.github.com/repos/laravel/framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/laravel/framework/issues/24421/comments","statuses_url":"https://api.github.com/repos/laravel/framework/statuses/8587eecfc43c8ece95b0d000843baab7c8b30643","head":{"label":"dmitrybubyakin:5.6","ref":"5.6","sha":"8587eecfc43c8ece95b0d000843baab7c8b30643","user":{"login":"dmitrybubyakin","id":11477505,"node_id":"MDQ6VXNlcjExNDc3NTA1","avatar_url":"https://avatars2.githubusercontent.com/u/11477505?v=4","gravatar_id":"","url":"https://api.github.com/users/dmitrybubyakin","html_url":"https://github.com/dmitrybubyakin","followers_url":"https://api.github.com/users/dmitrybubyakin/followers","following_url":"https://api.github.com/users/dmitrybubyakin/following{/other_user}","gists_url":"https://api.github.com/users/dmitrybubyakin/gists{/gist_id}","starred_url":"https://api.github.com/users/dmitrybubyakin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmitrybubyakin/subscriptions","organizations_url":"https://api.github.com/users/dmitrybubyakin/orgs","repos_url":"https://api.github.com/users/dmitrybubyakin/repos","events_url":"https://api.github.com/users/dmitrybubyakin/events{/privacy}","received_events_url":"https://api.github.com/users/dmitrybubyakin/received_events","type":"User","site_admin":false},"repo":{"id":135820698,"node_id":"MDEwOlJlcG9zaXRvcnkxMzU4MjA2OTg=","name":"framework","full_name":"dmitrybubyakin/framework","owner":{"login":"dmitrybubyakin","id":11477505,"node_id":"MDQ6VXNlcjExNDc3NTA1","avatar_url":"https://avatars2.githubusercontent.com/u/11477505?v=4","gravatar_id":"","url":"https://api.github.com/users/dmitrybubyakin","html_url":"https://github.com/dmitrybubyakin","followers_url":"https://api.github.com/users/dmitrybubyakin/followers","following_url":"https://api.github.com/users/dmitrybubyakin/following{/other_user}","gists_url":"https://api.github.com/users/dmitrybubyakin/gists{/gist_id}","starred_url":"https://api.github.com/users/dmitrybubyakin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmitrybubyakin/subscriptions","organizations_url":"https://api.github.com/users/dmitrybubyakin/orgs","repos_url":"https://api.github.com/users/dmitrybubyakin/repos","events_url":"https://api.github.com/users/dmitrybubyakin/events{/privacy}","received_events_url":"https://api.github.com/users/dmitrybubyakin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dmitrybubyakin/framework","description":null,"fork":true,"url":"https://api.github.com/repos/dmitrybubyakin/framework","forks_url":"https://api.github.com/repos/dmitrybubyakin/framework/forks","keys_url":"https://api.github.com/repos/dmitrybubyakin/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmitrybubyakin/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmitrybubyakin/framework/teams","hooks_url":"https://api.github.com/repos/dmitrybubyakin/framework/hooks","issue_events_url":"https://api.github.com/repos/dmitrybubyakin/framework/issues/events{/number}","events_url":"https://api.github.com/repos/dmitrybubyakin/framework/events","assignees_url":"https://api.github.com/repos/dmitrybubyakin/framework/assignees{/user}","branches_url":"https://api.github.com/repos/dmitrybubyakin/framework/branches{/branch}","tags_url":"https://api.github.com/repos/dmitrybubyakin/framework/tags","blobs_url":"https://api.github.com/repos/dmitrybubyakin/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmitrybubyakin/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmitrybubyakin/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmitrybubyakin/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmitrybubyakin/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/dmitrybubyakin/framework/languages","stargazers_url":"https://api.github.com/repos/dmitrybubyakin/framework/stargazers","contributors_url":"https://api.github.com/repos/dmitrybubyakin/framework/contributors","subscribers_url":"https://api.github.com/repos/dmitrybubyakin/framework/subscribers","subscription_url":"https://api.github.com/repos/dmitrybubyakin/framework/subscription","commits_url":"https://api.github.com/repos/dmitrybubyakin/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmitrybubyakin/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmitrybubyakin/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmitrybubyakin/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmitrybubyakin/framework/contents/{+path}","compare_url":"https://api.github.com/repos/dmitrybubyakin/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmitrybubyakin/framework/merges","archive_url":"https://api.github.com/repos/dmitrybubyakin/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmitrybubyakin/framework/downloads","issues_url":"https://api.github.com/repos/dmitrybubyakin/framework/issues{/number}","pulls_url":"https://api.github.com/repos/dmitrybubyakin/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/dmitrybubyakin/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/dmitrybubyakin/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmitrybubyakin/framework/labels{/name}","releases_url":"https://api.github.com/repos/dmitrybubyakin/framework/releases{/id}","deployments_url":"https://api.github.com/repos/dmitrybubyakin/framework/deployments","created_at":"2018-06-02T13:38:43Z","updated_at":"2018-06-02T14:47:56Z","pushed_at":"2018-06-02T14:47:54Z","git_url":"git://github.com/dmitrybubyakin/framework.git","ssh_url":"git@github.com:dmitrybubyakin/framework.git","clone_url":"https://github.com/dmitrybubyakin/framework.git","svn_url":"https://github.com/dmitrybubyakin/framework","homepage":"http://laravel.com","size":33785,"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.6"}},"base":{"label":"laravel:5.6","ref":"5.6","sha":"908135ec5aa5628fbecd01d9b0e23f9a84df16d0","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","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},"private":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-06-02T14:33:51Z","pushed_at":"2018-06-02T14:34:48Z","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":33785,"stargazers_count":12483,"watchers_count":12483,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5453,"mirror_url":null,"archived":false,"open_issues_count":162,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":5453,"open_issues":162,"watchers":12483,"default_branch":"5.6"}},"_links":{"self":{"href":"https://api.github.com/repos/laravel/framework/pulls/24421"},"html":{"href":"https://github.com/laravel/framework/pull/24421"},"issue":{"href":"https://api.github.com/repos/laravel/framework/issues/24421"},"comments":{"href":"https://api.github.com/repos/laravel/framework/issues/24421/comments"},"review_comments":{"href":"https://api.github.com/repos/laravel/framework/pulls/24421/comments"},"review_comment":{"href":"https://api.github.com/repos/laravel/framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/laravel/framework/pulls/24421/commits"},"statuses":{"href":"https://api.github.com/repos/laravel/framework/statuses/8587eecfc43c8ece95b0d000843baab7c8b30643"}},"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":2,"additions":88,"deletions":53,"changed_files":2}}
{"actor":{"display_login":"dmitrybubyakin"}}