{"action":"created","issue":{"url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/338","labels_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/338/labels{/name}","comments_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/338/comments","events_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/338/events","html_url":"https://github.com/lucadegasperi/oauth2-server-laravel/issues/338","id":65115536,"number":338,"title":"Setting User causing artisan route command to fail","user":{"login":"kidshenlong","id":3038394,"avatar_url":"https://avatars.githubusercontent.com/u/3038394?v=3","gravatar_id":"","url":"https://api.github.com/users/kidshenlong","html_url":"https://github.com/kidshenlong","followers_url":"https://api.github.com/users/kidshenlong/followers","following_url":"https://api.github.com/users/kidshenlong/following{/other_user}","gists_url":"https://api.github.com/users/kidshenlong/gists{/gist_id}","starred_url":"https://api.github.com/users/kidshenlong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kidshenlong/subscriptions","organizations_url":"https://api.github.com/users/kidshenlong/orgs","repos_url":"https://api.github.com/users/kidshenlong/repos","events_url":"https://api.github.com/users/kidshenlong/events{/privacy}","received_events_url":"https://api.github.com/users/kidshenlong/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-30T01:33:14Z","updated_at":"2015-03-30T13:24:41Z","closed_at":null,"body":"Setting a user object or using the Auth Facade in the constructor to allow user specific content. ie `$this->user->articles()`\r\n\r\n    class RandomController {\r\n        protected $user;\r\n        public function __construct(){\r\n        \t$this->user = User::findOrFail(Authorizer::getResourceOwnerId());\r\n        \t//Auth::loginUsingId(Authorizer::getResourceOwnerId());\r\n        }\r\n    }\r\n\r\nThis has worked fine but artisan commands (` php artisan route:list`) are failing with `[Symfony\\Component\\Debug\\Exception\\FatalErrorException]  \r\n  Call to a member function getSession() on null`\r\n\r\nI imagine because the constructor's running when the routes are queried... The issue doesn't persist if I set this in the individual route methods. But this feels hugely inefficient. Is there a prefered way of setting a user that would prevent this issue?"},"comment":{"url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/comments/87677711","html_url":"https://github.com/lucadegasperi/oauth2-server-laravel/issues/338#issuecomment-87677711","issue_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/338","id":87677711,"user":{"login":"kidshenlong","id":3038394,"avatar_url":"https://avatars.githubusercontent.com/u/3038394?v=3","gravatar_id":"","url":"https://api.github.com/users/kidshenlong","html_url":"https://github.com/kidshenlong","followers_url":"https://api.github.com/users/kidshenlong/followers","following_url":"https://api.github.com/users/kidshenlong/following{/other_user}","gists_url":"https://api.github.com/users/kidshenlong/gists{/gist_id}","starred_url":"https://api.github.com/users/kidshenlong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kidshenlong/subscriptions","organizations_url":"https://api.github.com/users/kidshenlong/orgs","repos_url":"https://api.github.com/users/kidshenlong/repos","events_url":"https://api.github.com/users/kidshenlong/events{/privacy}","received_events_url":"https://api.github.com/users/kidshenlong/received_events","type":"User","site_admin":false},"created_at":"2015-03-30T13:24:41Z","updated_at":"2015-03-30T13:24:41Z","body":"Sorry I guess I wasn't too clear. My issue is similar to https://github.com/lucadegasperi/oauth2-server-laravel/issues/194 in that `Authorizer::getResourceOwnerId()` doesn't really fail gracefully. \r\n\r\nThere's a solution posted on that issue that appears to do this but it looks a bit hacky."}}