{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/8115","labels_url":"https://api.github.com/repos/laravel/framework/issues/8115/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/8115/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/8115/events","html_url":"https://github.com/laravel/framework/pull/8115","id":63843685,"number":8115,"title":"Added Middleware Parameters","user":{"login":"ConnorVG","id":3260091,"avatar_url":"https://avatars.githubusercontent.com/u/3260091?v=3","gravatar_id":"","url":"https://api.github.com/users/ConnorVG","html_url":"https://github.com/ConnorVG","followers_url":"https://api.github.com/users/ConnorVG/followers","following_url":"https://api.github.com/users/ConnorVG/following{/other_user}","gists_url":"https://api.github.com/users/ConnorVG/gists{/gist_id}","starred_url":"https://api.github.com/users/ConnorVG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ConnorVG/subscriptions","organizations_url":"https://api.github.com/users/ConnorVG/orgs","repos_url":"https://api.github.com/users/ConnorVG/repos","events_url":"https://api.github.com/users/ConnorVG/events{/privacy}","received_events_url":"https://api.github.com/users/ConnorVG/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-23T21:57:19Z","updated_at":"2015-03-24T01:50:37Z","closed_at":"2015-03-24T01:50:37Z","pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/8115","html_url":"https://github.com/laravel/framework/pull/8115","diff_url":"https://github.com/laravel/framework/pull/8115.diff","patch_url":"https://github.com/laravel/framework/pull/8115.patch"},"body":"This adds middleware parameters (as requested here #6470). The implementation is simple to use.\r\n\r\nTo pass a parameters to a route middleware, simply do:\r\n```php\r\n/** etc.. */ [\r\n    'uses' => 'SomeController@method',\r\n    'middleware' => [\r\n        'someMiddleware' => [ /** data to pass */ ],\r\n        'guest' // other middleware works exactly as normal\r\n    ]\r\n] /** etc.. */\r\n```\r\n\r\nIn a controller:\r\n```php\r\n$this->middleware('someMiddleware', [ /** options as usual */ ], [ /** data to pass */ ]); \r\n```\r\n\r\nIn the Kernal middlewares array:\r\n```php\r\nprotected $middleware = [\r\n\t'Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode',\r\n\t'Illuminate\\Cookie\\Middleware\\EncryptCookies',\r\n\t'Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse',\r\n\t'Illuminate\\Session\\Middleware\\StartSession',\r\n\t'Illuminate\\View\\Middleware\\ShareErrorsFromSession',\r\n\t'App\\Http\\Middleware\\VerifyCsrfToken',\r\n\t'App\\Http\\Middleware\\SomeMiddleware' => [ /** data to pass */ ],\r\n];\r\n```\r\n\r\nAccessing the data in the middleware is very simple, it is the third parameter to the handle(...) function:\r\n```php\r\npublic function handle($request, Closure $next, $data = [ /** data that was passed */ ])\r\n{\r\n    return $next($request);\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/85288097","html_url":"https://github.com/laravel/framework/pull/8115#issuecomment-85288097","issue_url":"https://api.github.com/repos/laravel/framework/issues/8115","id":85288097,"user":{"login":"taylorotwell","id":463230,"avatar_url":"https://avatars.githubusercontent.com/u/463230?v=3","gravatar_id":"","url":"https://api.github.com/users/taylorotwell","html_url":"https://github.com/taylorotwell","followers_url":"https://api.github.com/users/taylorotwell/followers","following_url":"https://api.github.com/users/taylorotwell/following{/other_user}","gists_url":"https://api.github.com/users/taylorotwell/gists{/gist_id}","starred_url":"https://api.github.com/users/taylorotwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taylorotwell/subscriptions","organizations_url":"https://api.github.com/users/taylorotwell/orgs","repos_url":"https://api.github.com/users/taylorotwell/repos","events_url":"https://api.github.com/users/taylorotwell/events{/privacy}","received_events_url":"https://api.github.com/users/taylorotwell/received_events","type":"User","site_admin":false},"created_at":"2015-03-24T01:50:37Z","updated_at":"2015-03-24T01:50:37Z","body":"Yes it should be under discussion for 5.1."}}