{"action":"created","comment":{"url":"https://api.github.com/repos/laravel/docs/pulls/comments/23981116","id":23981116,"diff_hunk":"@@ -49,6 +49,40 @@ As you can see, if the given `age` is less than `200`, the middleware will retur\n \n It's best to envision middleware as a series of \"layers\" HTTP requests must pass through before they hit your application. Each layer can examine the request and even reject it entirely.\n \n+### *Before* vs *after* middleware\n+\n+Whether a middleware runs *before* or *after* a request has been processed depends on how performs its action:\n+\n+\t<?php namespace App\\Http\\Middleware;\n+\t\n+\tclass BeforeMiddleware implements Middleware {","path":"middleware.md","position":10,"original_position":10,"commit_id":"c15605d81d2b1b7ffe10784afbb0565fcd8064ba","original_commit_id":"c15605d81d2b1b7ffe10784afbb0565fcd8064ba","user":{"login":"JosephSilber","id":1403741,"avatar_url":"https://avatars.githubusercontent.com/u/1403741?v=3","gravatar_id":"","url":"https://api.github.com/users/JosephSilber","html_url":"https://github.com/JosephSilber","followers_url":"https://api.github.com/users/JosephSilber/followers","following_url":"https://api.github.com/users/JosephSilber/following{/other_user}","gists_url":"https://api.github.com/users/JosephSilber/gists{/gist_id}","starred_url":"https://api.github.com/users/JosephSilber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosephSilber/subscriptions","organizations_url":"https://api.github.com/users/JosephSilber/orgs","repos_url":"https://api.github.com/users/JosephSilber/repos","events_url":"https://api.github.com/users/JosephSilber/events{/privacy}","received_events_url":"https://api.github.com/users/JosephSilber/received_events","type":"User","site_admin":false},"body":"What is this interface?\r\n\r\n:sweat_smile: ","created_at":"2015-02-03T03:50:15Z","updated_at":"2015-02-03T03:50:15Z","html_url":"https://github.com/laravel/docs/pull/1074#discussion_r23981116","pull_request_url":"https://api.github.com/repos/laravel/docs/pulls/1074","_links":{"self":{"href":"https://api.github.com/repos/laravel/docs/pulls/comments/23981116"},"html":{"href":"https://github.com/laravel/docs/pull/1074#discussion_r23981116"},"pull_request":{"href":"https://api.github.com/repos/laravel/docs/pulls/1074"}}},"pull_request":{"url":"https://api.github.com/repos/laravel/docs/pulls/1074","id":28506029,"html_url":"https://github.com/laravel/docs/pull/1074","diff_url":"https://github.com/laravel/docs/pull/1074.diff","patch_url":"https://github.com/laravel/docs/pull/1074.patch","issue_url":"https://api.github.com/repos/laravel/docs/issues/1074","number":1074,"state":"open","locked":false,"title":"Clarify middleware running before/after a request has been processed","user":{"login":"HipsterJazzbo","id":231361,"avatar_url":"https://avatars.githubusercontent.com/u/231361?v=3","gravatar_id":"","url":"https://api.github.com/users/HipsterJazzbo","html_url":"https://github.com/HipsterJazzbo","followers_url":"https://api.github.com/users/HipsterJazzbo/followers","following_url":"https://api.github.com/users/HipsterJazzbo/following{/other_user}","gists_url":"https://api.github.com/users/HipsterJazzbo/gists{/gist_id}","starred_url":"https://api.github.com/users/HipsterJazzbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HipsterJazzbo/subscriptions","organizations_url":"https://api.github.com/users/HipsterJazzbo/orgs","repos_url":"https://api.github.com/users/HipsterJazzbo/repos","events_url":"https://api.github.com/users/HipsterJazzbo/events{/privacy}","received_events_url":"https://api.github.com/users/HipsterJazzbo/received_events","type":"User","site_admin":false},"body":"This is quite confusing to a lot of people until they can see an example.\r\n\r\nContent lifted/paraphrased with permission from @mattstauffer: http://mattstauffer.co/blog/laravel-5.0-middleware-filter-style","created_at":"2015-02-02T21:51:02Z","updated_at":"2015-02-03T03:50:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"02d59adcb28c384a9cbd19ecfa8838c4a46a1fda","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/laravel/docs/pulls/1074/commits","review_comments_url":"https://api.github.com/repos/laravel/docs/pulls/1074/comments","review_comment_url":"https://api.github.com/repos/laravel/docs/pulls/comments/{number}","comments_url":"https://api.github.com/repos/laravel/docs/issues/1074/comments","statuses_url":"https://api.github.com/repos/laravel/docs/statuses/c15605d81d2b1b7ffe10784afbb0565fcd8064ba","head":{"label":"HipsterJazzbo:patch-3","ref":"patch-3","sha":"c15605d81d2b1b7ffe10784afbb0565fcd8064ba","user":{"login":"HipsterJazzbo","id":231361,"avatar_url":"https://avatars.githubusercontent.com/u/231361?v=3","gravatar_id":"","url":"https://api.github.com/users/HipsterJazzbo","html_url":"https://github.com/HipsterJazzbo","followers_url":"https://api.github.com/users/HipsterJazzbo/followers","following_url":"https://api.github.com/users/HipsterJazzbo/following{/other_user}","gists_url":"https://api.github.com/users/HipsterJazzbo/gists{/gist_id}","starred_url":"https://api.github.com/users/HipsterJazzbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HipsterJazzbo/subscriptions","organizations_url":"https://api.github.com/users/HipsterJazzbo/orgs","repos_url":"https://api.github.com/users/HipsterJazzbo/repos","events_url":"https://api.github.com/users/HipsterJazzbo/events{/privacy}","received_events_url":"https://api.github.com/users/HipsterJazzbo/received_events","type":"User","site_admin":false},"repo":{"id":20627737,"name":"docs","full_name":"HipsterJazzbo/docs","owner":{"login":"HipsterJazzbo","id":231361,"avatar_url":"https://avatars.githubusercontent.com/u/231361?v=3","gravatar_id":"","url":"https://api.github.com/users/HipsterJazzbo","html_url":"https://github.com/HipsterJazzbo","followers_url":"https://api.github.com/users/HipsterJazzbo/followers","following_url":"https://api.github.com/users/HipsterJazzbo/following{/other_user}","gists_url":"https://api.github.com/users/HipsterJazzbo/gists{/gist_id}","starred_url":"https://api.github.com/users/HipsterJazzbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HipsterJazzbo/subscriptions","organizations_url":"https://api.github.com/users/HipsterJazzbo/orgs","repos_url":"https://api.github.com/users/HipsterJazzbo/repos","events_url":"https://api.github.com/users/HipsterJazzbo/events{/privacy}","received_events_url":"https://api.github.com/users/HipsterJazzbo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/HipsterJazzbo/docs","description":"The Laravel Framework Documentation","fork":true,"url":"https://api.github.com/repos/HipsterJazzbo/docs","forks_url":"https://api.github.com/repos/HipsterJazzbo/docs/forks","keys_url":"https://api.github.com/repos/HipsterJazzbo/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HipsterJazzbo/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HipsterJazzbo/docs/teams","hooks_url":"https://api.github.com/repos/HipsterJazzbo/docs/hooks","issue_events_url":"https://api.github.com/repos/HipsterJazzbo/docs/issues/events{/number}","events_url":"https://api.github.com/repos/HipsterJazzbo/docs/events","assignees_url":"https://api.github.com/repos/HipsterJazzbo/docs/assignees{/user}","branches_url":"https://api.github.com/repos/HipsterJazzbo/docs/branches{/branch}","tags_url":"https://api.github.com/repos/HipsterJazzbo/docs/tags","blobs_url":"https://api.github.com/repos/HipsterJazzbo/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HipsterJazzbo/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HipsterJazzbo/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/HipsterJazzbo/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HipsterJazzbo/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/HipsterJazzbo/docs/languages","stargazers_url":"https://api.github.com/repos/HipsterJazzbo/docs/stargazers","contributors_url":"https://api.github.com/repos/HipsterJazzbo/docs/contributors","subscribers_url":"https://api.github.com/repos/HipsterJazzbo/docs/subscribers","subscription_url":"https://api.github.com/repos/HipsterJazzbo/docs/subscription","commits_url":"https://api.github.com/repos/HipsterJazzbo/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/HipsterJazzbo/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/HipsterJazzbo/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/HipsterJazzbo/docs/issues/comments/{number}","contents_url":"https://api.github.com/repos/HipsterJazzbo/docs/contents/{+path}","compare_url":"https://api.github.com/repos/HipsterJazzbo/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HipsterJazzbo/docs/merges","archive_url":"https://api.github.com/repos/HipsterJazzbo/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HipsterJazzbo/docs/downloads","issues_url":"https://api.github.com/repos/HipsterJazzbo/docs/issues{/number}","pulls_url":"https://api.github.com/repos/HipsterJazzbo/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/HipsterJazzbo/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/HipsterJazzbo/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HipsterJazzbo/docs/labels{/name}","releases_url":"https://api.github.com/repos/HipsterJazzbo/docs/releases{/id}","created_at":"2014-06-08T22:15:06Z","updated_at":"2014-06-26T06:09:53Z","pushed_at":"2015-02-02T21:48:04Z","git_url":"git://github.com/HipsterJazzbo/docs.git","ssh_url":"git@github.com:HipsterJazzbo/docs.git","clone_url":"https://github.com/HipsterJazzbo/docs.git","svn_url":"https://github.com/HipsterJazzbo/docs","homepage":null,"size":2078,"stargazers_count":0,"watchers_count":0,"language":null,"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":"master"}},"base":{"label":"laravel:master","ref":"master","sha":"b9a36721b40146f7f97374bbc4f53fc9c769afb0","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":7546847,"name":"docs","full_name":"laravel/docs","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/docs","description":"","fork":false,"url":"https://api.github.com/repos/laravel/docs","forks_url":"https://api.github.com/repos/laravel/docs/forks","keys_url":"https://api.github.com/repos/laravel/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/laravel/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/laravel/docs/teams","hooks_url":"https://api.github.com/repos/laravel/docs/hooks","issue_events_url":"https://api.github.com/repos/laravel/docs/issues/events{/number}","events_url":"https://api.github.com/repos/laravel/docs/events","assignees_url":"https://api.github.com/repos/laravel/docs/assignees{/user}","branches_url":"https://api.github.com/repos/laravel/docs/branches{/branch}","tags_url":"https://api.github.com/repos/laravel/docs/tags","blobs_url":"https://api.github.com/repos/laravel/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/laravel/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/laravel/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/laravel/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/laravel/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/laravel/docs/languages","stargazers_url":"https://api.github.com/repos/laravel/docs/stargazers","contributors_url":"https://api.github.com/repos/laravel/docs/contributors","subscribers_url":"https://api.github.com/repos/laravel/docs/subscribers","subscription_url":"https://api.github.com/repos/laravel/docs/subscription","commits_url":"https://api.github.com/repos/laravel/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/laravel/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/laravel/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/laravel/docs/issues/comments/{number}","contents_url":"https://api.github.com/repos/laravel/docs/contents/{+path}","compare_url":"https://api.github.com/repos/laravel/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/laravel/docs/merges","archive_url":"https://api.github.com/repos/laravel/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/laravel/docs/downloads","issues_url":"https://api.github.com/repos/laravel/docs/issues{/number}","pulls_url":"https://api.github.com/repos/laravel/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/laravel/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/laravel/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/laravel/docs/labels{/name}","releases_url":"https://api.github.com/repos/laravel/docs/releases{/id}","created_at":"2013-01-10T19:08:45Z","updated_at":"2015-02-02T21:17:10Z","pushed_at":"2015-02-03T02:47:08Z","git_url":"git://github.com/laravel/docs.git","ssh_url":"git@github.com:laravel/docs.git","clone_url":"https://github.com/laravel/docs.git","svn_url":"https://github.com/laravel/docs","homepage":"","size":9491,"stargazers_count":402,"watchers_count":402,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":836,"mirror_url":null,"open_issues_count":75,"forks":836,"open_issues":75,"watchers":402,"default_branch":"4.2"}},"_links":{"self":{"href":"https://api.github.com/repos/laravel/docs/pulls/1074"},"html":{"href":"https://github.com/laravel/docs/pull/1074"},"issue":{"href":"https://api.github.com/repos/laravel/docs/issues/1074"},"comments":{"href":"https://api.github.com/repos/laravel/docs/issues/1074/comments"},"review_comments":{"href":"https://api.github.com/repos/laravel/docs/pulls/1074/comments"},"review_comment":{"href":"https://api.github.com/repos/laravel/docs/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/laravel/docs/pulls/1074/commits"},"statuses":{"href":"https://api.github.com/repos/laravel/docs/statuses/c15605d81d2b1b7ffe10784afbb0565fcd8064ba"}}}}