{"action":"closed","issue":{"url":"https://api.github.com/repos/spatie/laravel-permission/issues/782","repository_url":"https://api.github.com/repos/spatie/laravel-permission","labels_url":"https://api.github.com/repos/spatie/laravel-permission/issues/782/labels{/name}","comments_url":"https://api.github.com/repos/spatie/laravel-permission/issues/782/comments","events_url":"https://api.github.com/repos/spatie/laravel-permission/issues/782/events","html_url":"https://github.com/spatie/laravel-permission/issues/782","id":338927673,"node_id":"MDU6SXNzdWUzMzg5Mjc2NzM=","number":782,"title":"Assign Role to Controller Method via middleware","user":{"login":"arunmisra2273","id":17044010,"node_id":"MDQ6VXNlcjE3MDQ0MDEw","avatar_url":"https://avatars3.githubusercontent.com/u/17044010?v=4","gravatar_id":"","url":"https://api.github.com/users/arunmisra2273","html_url":"https://github.com/arunmisra2273","followers_url":"https://api.github.com/users/arunmisra2273/followers","following_url":"https://api.github.com/users/arunmisra2273/following{/other_user}","gists_url":"https://api.github.com/users/arunmisra2273/gists{/gist_id}","starred_url":"https://api.github.com/users/arunmisra2273/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunmisra2273/subscriptions","organizations_url":"https://api.github.com/users/arunmisra2273/orgs","repos_url":"https://api.github.com/users/arunmisra2273/repos","events_url":"https://api.github.com/users/arunmisra2273/events{/privacy}","received_events_url":"https://api.github.com/users/arunmisra2273/received_events","type":"User","site_admin":false},"labels":[{"id":887733324,"node_id":"MDU6TGFiZWw4ODc3MzMzMjQ=","url":"https://api.github.com/repos/spatie/laravel-permission/labels/support","name":"support","color":"f9ef93","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-06T12:51:37Z","updated_at":"2018-08-02T19:38:24Z","closed_at":"2018-08-02T19:38:24Z","author_association":"NONE","body":"I am new to this package. I need a little basic help.\r\nI have a resource controller. I have 3 roles, superadmin, admin and prime.\r\nI want users with superadmin and admin roles to access all controller methods.\r\nADDITIONALLY, I want users with prime role to be able to access ONLY the update method.\r\n\r\nI have used the following and I get \"message\": \"User does not have the right roles.\", when a user with prime role tries to use the update function. \r\n\r\npublic function __construct()\r\n    {\r\n        $this->middleware('JWT');\r\n        $this->middleware(['role:superadmin|admin']);\r\n        $this->middleware(['role:prime'])->only('update');\r\n        \r\n    }\r\n\r\nI will be obliged if someone could kindly guide me.\r\nP.S. I understand I can check for user role inside the update method. But is there a clean way of doing it from the constructor?"}}
{"actor":{"display_login":"drbyte"}}