{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/13171","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/13171/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/13171/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/13171/events","html_url":"https://github.com/laravel/framework/pull/13171","id":148552216,"number":13171,"title":"Method Model::removeGlobalScope()","user":{"login":"felixmaier1989","id":10077436,"avatar_url":"https://avatars.githubusercontent.com/u/10077436?v=3","gravatar_id":"","url":"https://api.github.com/users/felixmaier1989","html_url":"https://github.com/felixmaier1989","followers_url":"https://api.github.com/users/felixmaier1989/followers","following_url":"https://api.github.com/users/felixmaier1989/following{/other_user}","gists_url":"https://api.github.com/users/felixmaier1989/gists{/gist_id}","starred_url":"https://api.github.com/users/felixmaier1989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixmaier1989/subscriptions","organizations_url":"https://api.github.com/users/felixmaier1989/orgs","repos_url":"https://api.github.com/users/felixmaier1989/repos","events_url":"https://api.github.com/users/felixmaier1989/events{/privacy}","received_events_url":"https://api.github.com/users/felixmaier1989/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-15T04:28:52Z","updated_at":"2016-04-15T04:37:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/13171","html_url":"https://github.com/laravel/framework/pull/13171","diff_url":"https://github.com/laravel/framework/pull/13171.diff","patch_url":"https://github.com/laravel/framework/pull/13171.patch"},"body":"I have a model where I apply a scope on boot. Basically this model will always need this scope, excepted a few exceptions. On these exceptions I want to disable this scope. As I couldnt find an acceptable way to do so, I thought about this `removeGlobalScope()` method.\r\n\r\nFor the record, I used to disable my scope by calling the scope's remove() method:\r\n\r\n```\r\n$model = new MyModel();\r\n$builder = $model->newQuery();\r\n$model->getGlobalScopes()['Path\\To\\My\\Scope']->remove($builder, $model);\r\n$results = $builder->get();\r\n```\r\n\r\nwhich was no longer possible after updating illuminate/database from `v5.1.25` to `v5.2.28`. I believe this commit https://github.com/laravel/framework/commit/9cce184103e6ef40d90dd601224efa11e30884b2 is the cause.\r\nSince this commit there is no way to disable one scope before calling `get()` as the scopes arent applied until you call this function."},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/210283423","html_url":"https://github.com/laravel/framework/pull/13171#issuecomment-210283423","issue_url":"https://api.github.com/repos/laravel/framework/issues/13171","id":210283423,"user":{"login":"lagbox","id":3752215,"avatar_url":"https://avatars.githubusercontent.com/u/3752215?v=3","gravatar_id":"","url":"https://api.github.com/users/lagbox","html_url":"https://github.com/lagbox","followers_url":"https://api.github.com/users/lagbox/followers","following_url":"https://api.github.com/users/lagbox/following{/other_user}","gists_url":"https://api.github.com/users/lagbox/gists{/gist_id}","starred_url":"https://api.github.com/users/lagbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lagbox/subscriptions","organizations_url":"https://api.github.com/users/lagbox/orgs","repos_url":"https://api.github.com/users/lagbox/repos","events_url":"https://api.github.com/users/lagbox/events{/privacy}","received_events_url":"https://api.github.com/users/lagbox/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T04:37:09Z","updated_at":"2016-04-15T04:37:09Z","body":"That is disabling only one. If you pass an array it would disable multiple ones."}}