{"action":"created","issue":{"url":"https://api.github.com/repos/slimphp/Slim/issues/1265","labels_url":"https://api.github.com/repos/slimphp/Slim/issues/1265/labels{/name}","comments_url":"https://api.github.com/repos/slimphp/Slim/issues/1265/comments","events_url":"https://api.github.com/repos/slimphp/Slim/issues/1265/events","html_url":"https://github.com/slimphp/Slim/issues/1265","id":85125855,"number":1265,"title":"[Develop] Adding Middleware to Route Groups","user":{"login":"geggleto","id":4027602,"avatar_url":"https://avatars.githubusercontent.com/u/4027602?v=3","gravatar_id":"","url":"https://api.github.com/users/geggleto","html_url":"https://github.com/geggleto","followers_url":"https://api.github.com/users/geggleto/followers","following_url":"https://api.github.com/users/geggleto/following{/other_user}","gists_url":"https://api.github.com/users/geggleto/gists{/gist_id}","starred_url":"https://api.github.com/users/geggleto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geggleto/subscriptions","organizations_url":"https://api.github.com/users/geggleto/orgs","repos_url":"https://api.github.com/users/geggleto/repos","events_url":"https://api.github.com/users/geggleto/events{/privacy}","received_events_url":"https://api.github.com/users/geggleto/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/slimphp/Slim/labels/pending%20feedback","name":"pending feedback","color":"DDDDDD"},{"url":"https://api.github.com/repos/slimphp/Slim/labels/Slim%203","name":"Slim 3","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-04T14:37:32Z","updated_at":"2015-06-07T17:04:59Z","closed_at":null,"body":"Come to find out that the process for adding middleware to route groups is different than adding them to routes.\r\n\r\nWhat I expected:\r\n`$app->group('/', function () { })->add('\\Security:check');`\r\n\r\nCurrent\r\n`$app->group('/', \\Security:check, function () { });`\r\n\r\nWhere \\Security:check must return a callable which is the middleware wrapped in a function.\r\n\r\nSo I would suggest 2 things.\r\n\r\n1) We change the middleware to be added like route middleware which is a ->add at the end\r\n2) We also add the resolveCallable onto that so that things get resolved properly."},"comment":{"url":"https://api.github.com/repos/slimphp/Slim/issues/comments/109773301","html_url":"https://github.com/slimphp/Slim/issues/1265#issuecomment-109773301","issue_url":"https://api.github.com/repos/slimphp/Slim/issues/1265","id":109773301,"user":{"login":"designermonkey","id":221344,"avatar_url":"https://avatars.githubusercontent.com/u/221344?v=3","gravatar_id":"","url":"https://api.github.com/users/designermonkey","html_url":"https://github.com/designermonkey","followers_url":"https://api.github.com/users/designermonkey/followers","following_url":"https://api.github.com/users/designermonkey/following{/other_user}","gists_url":"https://api.github.com/users/designermonkey/gists{/gist_id}","starred_url":"https://api.github.com/users/designermonkey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/designermonkey/subscriptions","organizations_url":"https://api.github.com/users/designermonkey/orgs","repos_url":"https://api.github.com/users/designermonkey/repos","events_url":"https://api.github.com/users/designermonkey/events{/privacy}","received_events_url":"https://api.github.com/users/designermonkey/received_events","type":"User","site_admin":false},"created_at":"2015-06-07T17:04:59Z","updated_at":"2015-06-07T17:04:59Z","body":"I was always a little uncomfortable with how routes and groups were done, so I wrote something to play with that made a new class of `RouteGroup` alongside `Route`.\r\n\r\nI'll dig out the code and try to marge it back in to Slim3 (it was a while ago, and many things have changed).\r\n\r\nWhat the code did was made routes and groups essentially the same thing (so things like middleware were handled exactly the same way), but one could have children. It followed the same principal for dispatching, but that part has to be updated due to the PSR-7 work in Slim since I wrote it.\r\n\r\n"}}