GitHub PullRequestEvent at 2014-11-20 04:11:32
Repository: framework
Actor: taylorotwell
Payload: {"action":"closed","number":6414,"pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/6414","id":24490606,"html_url":"https://github.com/laravel/framework/pull/6414","diff_url":"https://github.com/laravel/framework/pull/6414.diff","patch_url":"https://github.com/laravel/framework/pull/6414.patch","issue_url":"https://api.github.com/repos/laravel/framework/issues/6414","number":6414,"state":"closed","locked":false,"title":"[5.0] Added Callable Wheres On Route","user":{"login":"IonutBajescu","id":5365516,"avatar_url":"https://avatars.githubusercontent.com/u/5365516?v=3","gravatar_id":"","url":"https://api.github.com/users/IonutBajescu","html_url":"https://github.com/IonutBajescu","followers_url":"https://api.github.com/users/IonutBajescu/followers","following_url":"https://api.github.com/users/IonutBajescu/following{/other_user}","gists_url":"https://api.github.com/users/IonutBajescu/gists{/gist_id}","starred_url":"https://api.github.com/users/IonutBajescu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IonutBajescu/subscriptions","organizations_url":"https://api.github.com/users/IonutBajescu/orgs","repos_url":"https://api.github.com/users/IonutBajescu/repos","events_url":"https://api.github.com/users/IonutBajescu/events{/privacy}","received_events_url":"https://api.github.com/users/IonutBajescu/received_events","type":"User","site_admin":false},"body":"Example of usage:\r\n```php\r\n$router\r\n\t->get('/{page}', function(){\r\n\t\treturn 'a page';\r\n\t})\r\n\t->where(function($route, $request){\r\n\t\t$slugs = ['about', 'tos'];\r\n\t\treturn in_array($route->page, $slugs);\r\n\t});\r\n\r\n$router\r\n\t->get('/{post}', function(){\r\n\t\treturn 'a post';\r\n\t})\r\n\t->where(function($route, $request){\r\n\t\t$slugs = ['hello-world'];\r\n\t\treturn in_array($route->post, $slugs);\r\n\t});\r\n```\r\n\r\nA huge number of projects needs this feature. Before callable wheres we used some regex \"hacks\" with slugs separated by |, or a ugly foreach. Ex:\r\n```php\r\n$slugs = Page::lists('slug');\r\nforeach($slugs as $slug){\r\n    Route::get('/'.$slug, function() use($slug){\r\n        return View::make('page')->with('slug', $slug);\r\n    });\r\n}\r\n```","created_at":"2014-11-15T16:06:00Z","updated_at":"2014-11-20T04:11:32Z","closed_at":"2014-11-20T04:11:32Z","merged_at":null,"merge_commit_sha":"822b98ea5aa2636453431e5c8c95f042535880b3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/laravel/framework/pulls/6414/commits","review_comments_url":"https://api.github.com/repos/laravel/framework/pulls/6414/comments","review_comment_url":"https://api.github.com/repos/laravel/framework/pulls/comments/{number}","comments_url":"https://api.github.com/repos/laravel/framework/issues/6414/comments","statuses_url":"https://api.github.com/repos/laravel/framework/statuses/eba82279073099c54e692d30eda72f3c96337567","head":{"label":"IonutBajescu:callable_wheres_feature","ref":"callable_wheres_feature","sha":"eba82279073099c54e692d30eda72f3c96337567","user":{"login":"IonutBajescu","id":5365516,"avatar_url":"https://avatars.githubusercontent.com/u/5365516?v=3","gravatar_id":"","url":"https://api.github.com/users/IonutBajescu","html_url":"https://github.com/IonutBajescu","followers_url":"https://api.github.com/users/IonutBajescu/followers","following_url":"https://api.github.com/users/IonutBajescu/following{/other_user}","gists_url":"https://api.github.com/users/IonutBajescu/gists{/gist_id}","starred_url":"https://api.github.com/users/IonutBajescu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IonutBajescu/subscriptions","organizations_url":"https://api.github.com/users/IonutBajescu/orgs","repos_url":"https://api.github.com/users/IonutBajescu/repos","events_url":"https://api.github.com/users/IonutBajescu/events{/privacy}","received_events_url":"https://api.github.com/users/IonutBajescu/received_events","type":"User","site_admin":false},"repo":{"id":26682322,"name":"framework","full_name":"IonutBajescu/framework","owner":{"login":"IonutBajescu","id":5365516,"avatar_url":"https://avatars.githubusercontent.com/u/5365516?v=3","gravatar_id":"","url":"https://api.github.com/users/IonutBajescu","html_url":"https://github.com/IonutBajescu","followers_url":"https://api.github.com/users/IonutBajescu/followers","following_url":"https://api.github.com/users/IonutBajescu/following{/other_user}","gists_url":"https://api.github.com/users/IonutBajescu/gists{/gist_id}","starred_url":"https://api.github.com/users/IonutBajescu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IonutBajescu/subscriptions","organizations_url":"https://api.github.com/users/IonutBajescu/orgs","repos_url":"https://api.github.com/users/IonutBajescu/repos","events_url":"https://api.github.com/users/IonutBajescu/events{/privacy}","received_events_url":"https://api.github.com/users/IonutBajescu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/IonutBajescu/framework","description":"","fork":true,"url":"https://api.github.com/repos/IonutBajescu/framework","forks_url":"https://api.github.com/repos/IonutBajescu/framework/forks","keys_url":"https://api.github.com/repos/IonutBajescu/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IonutBajescu/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IonutBajescu/framework/teams","hooks_url":"https://api.github.com/repos/IonutBajescu/framework/hooks","issue_events_url":"https://api.github.com/repos/IonutBajescu/framework/issues/events{/number}","events_url":"https://api.github.com/repos/IonutBajescu/framework/events","assignees_url":"https://api.github.com/repos/IonutBajescu/framework/assignees{/user}","branches_url":"https://api.github.com/repos/IonutBajescu/framework/branches{/branch}","tags_url":"https://api.github.com/repos/IonutBajescu/framework/tags","blobs_url":"https://api.github.com/repos/IonutBajescu/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IonutBajescu/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IonutBajescu/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/IonutBajescu/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IonutBajescu/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/IonutBajescu/framework/languages","stargazers_url":"https://api.github.com/repos/IonutBajescu/framework/stargazers","contributors_url":"https://api.github.com/repos/IonutBajescu/framework/contributors","subscribers_url":"https://api.github.com/repos/IonutBajescu/framework/subscribers","subscription_url":"https://api.github.com/repos/IonutBajescu/framework/subscription","commits_url":"https://api.github.com/repos/IonutBajescu/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/IonutBajescu/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/IonutBajescu/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/IonutBajescu/framework/issues/comments/{number}","contents_url":"https://api.github.com/repos/IonutBajescu/framework/contents/{+path}","compare_url":"https://api.github.com/repos/IonutBajescu/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IonutBajescu/framework/merges","archive_url":"https://api.github.com/repos/IonutBajescu/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IonutBajescu/framework/downloads","issues_url":"https://api.github.com/repos/IonutBajescu/framework/issues{/number}","pulls_url":"https://api.github.com/repos/IonutBajescu/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/IonutBajescu/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/IonutBajescu/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IonutBajescu/framework/labels{/name}","releases_url":"https://api.github.com/repos/IonutBajescu/framework/releases{/id}","created_at":"2014-11-15T14:31:09Z","updated_at":"2014-11-15T14:31:12Z","pushed_at":"2014-11-16T01:12:04Z","git_url":"git://github.com/IonutBajescu/framework.git","ssh_url":"git@github.com:IonutBajescu/framework.git","clone_url":"https://github.com/IonutBajescu/framework.git","svn_url":"https://github.com/IonutBajescu/framework","homepage":"http://laravel.com","size":11698,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"4.2"}},"base":{"label":"laravel:master","ref":"master","sha":"81614916082260c524b5a178e896f3f0ce79b820","user":{"login":"laravel","id":958072,"avatar_url":"https://avatars.githubusercontent.com/u/958072?v=3","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,"name":"framework","full_name":"laravel/framework","owner":{"login":"laravel","id":958072,"avatar_url":"https://avatars.githubusercontent.com/u/958072?v=3","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":"","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}","created_at":"2013-01-10T21:27:28Z","updated_at":"2014-11-20T04:10:12Z","pushed_at":"2014-11-20T04:10:12Z","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":64376,"stargazers_count":2727,"watchers_count":2727,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1530,"mirror_url":null,"open_issues_count":460,"forks":1530,"open_issues":460,"watchers":2727,"default_branch":"4.2"}},"_links":{"self":{"href":"https://api.github.com/repos/laravel/framework/pulls/6414"},"html":{"href":"https://github.com/laravel/framework/pull/6414"},"issue":{"href":"https://api.github.com/repos/laravel/framework/issues/6414"},"comments":{"href":"https://api.github.com/repos/laravel/framework/issues/6414/comments"},"review_comments":{"href":"https://api.github.com/repos/laravel/framework/pulls/6414/comments"},"review_comment":{"href":"https://api.github.com/repos/laravel/framework/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/laravel/framework/pulls/6414/commits"},"statuses":{"href":"https://api.github.com/repos/laravel/framework/statuses/eba82279073099c54e692d30eda72f3c96337567"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":2,"review_comments":33,"commits":1,"additions":216,"deletions":1,"changed_files":4}}