{"action":"created","issue":{"url":"https://api.github.com/repos/spatie/laravel-permission/issues/125","repository_url":"https://api.github.com/repos/spatie/laravel-permission","labels_url":"https://api.github.com/repos/spatie/laravel-permission/issues/125/labels{/name}","comments_url":"https://api.github.com/repos/spatie/laravel-permission/issues/125/comments","events_url":"https://api.github.com/repos/spatie/laravel-permission/issues/125/events","html_url":"https://github.com/spatie/laravel-permission/issues/125","id":176309012,"number":125,"title":"500 on hasPermissionTo without permission existing","user":{"login":"lukasoppermann","id":813754,"avatar_url":"https://avatars.githubusercontent.com/u/813754?v=3","gravatar_id":"","url":"https://api.github.com/users/lukasoppermann","html_url":"https://github.com/lukasoppermann","followers_url":"https://api.github.com/users/lukasoppermann/followers","following_url":"https://api.github.com/users/lukasoppermann/following{/other_user}","gists_url":"https://api.github.com/users/lukasoppermann/gists{/gist_id}","starred_url":"https://api.github.com/users/lukasoppermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukasoppermann/subscriptions","organizations_url":"https://api.github.com/users/lukasoppermann/orgs","repos_url":"https://api.github.com/users/lukasoppermann/repos","events_url":"https://api.github.com/users/lukasoppermann/events{/privacy}","received_events_url":"https://api.github.com/users/lukasoppermann/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-12T07:18:26Z","updated_at":"2016-09-12T08:48:17Z","closed_at":"2016-09-12T08:48:17Z","body":"Hey,\r\n\r\nI am not sure this is by design but if you do `$user->hasPermissionTo('doesn't exist')` you a 500 error with: \r\n\r\n> PermissionDoesNotExist in Permission.php line 71:\r\n\r\nI feel this should possibly be handled by the package as in: `return false` for the permission check and log an error in the logs, maybe?"},"comment":{"url":"https://api.github.com/repos/spatie/laravel-permission/issues/comments/246285681","html_url":"https://github.com/spatie/laravel-permission/issues/125#issuecomment-246285681","issue_url":"https://api.github.com/repos/spatie/laravel-permission/issues/125","id":246285681,"user":{"login":"freekmurze","id":483853,"avatar_url":"https://avatars.githubusercontent.com/u/483853?v=3","gravatar_id":"","url":"https://api.github.com/users/freekmurze","html_url":"https://github.com/freekmurze","followers_url":"https://api.github.com/users/freekmurze/followers","following_url":"https://api.github.com/users/freekmurze/following{/other_user}","gists_url":"https://api.github.com/users/freekmurze/gists{/gist_id}","starred_url":"https://api.github.com/users/freekmurze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freekmurze/subscriptions","organizations_url":"https://api.github.com/users/freekmurze/orgs","repos_url":"https://api.github.com/users/freekmurze/repos","events_url":"https://api.github.com/users/freekmurze/events{/privacy}","received_events_url":"https://api.github.com/users/freekmurze/received_events","type":"User","site_admin":false},"created_at":"2016-09-12T08:48:17Z","updated_at":"2016-09-12T08:48:17Z","body":"To be precise, the package only throws the exception. It's the app the makes a `500` out of it because it isn't catched.\r\n\r\nI was thinking about returning `false` when creating the package but I choose an `Exception` because when dealing with security it's probably a good thing to be very explicit when something goes wrong.\r\n\r\nIn most cases the permission to be added will exist.  If in your project this isn't the case, make your own `hasPermissionTo` function that eats up the thrown exception by this package."}}
{"actor":{"display_login":"freekmurze"}}