{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/13666","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/13666/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/13666/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/13666/events","html_url":"https://github.com/laravel/framework/issues/13666","id":156454120,"number":13666,"title":"add where clause to the result of a union","user":{"login":"salarAsadi","id":7926174,"avatar_url":"https://avatars.githubusercontent.com/u/7926174?v=3","gravatar_id":"","url":"https://api.github.com/users/salarAsadi","html_url":"https://github.com/salarAsadi","followers_url":"https://api.github.com/users/salarAsadi/followers","following_url":"https://api.github.com/users/salarAsadi/following{/other_user}","gists_url":"https://api.github.com/users/salarAsadi/gists{/gist_id}","starred_url":"https://api.github.com/users/salarAsadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salarAsadi/subscriptions","organizations_url":"https://api.github.com/users/salarAsadi/orgs","repos_url":"https://api.github.com/users/salarAsadi/repos","events_url":"https://api.github.com/users/salarAsadi/events{/privacy}","received_events_url":"https://api.github.com/users/salarAsadi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-05-24T08:57:04Z","updated_at":"2016-12-12T14:08:51Z","closed_at":null,"body":"I'm doing a union on two queries, and I want to add a where clause to the result, but the where clause is added only to the first query. how can I fix that?\n\n```\n$notifications = DB::table('notifications')\n    ->select(DB::raw(\"notifications.uuid ,notifications.brand_id\" ))\n$posts = DB::table('posts')\n    ->select(DB::raw(\"posts.uuid ,posts.brand_id\" ))\n    ->unionAll ($notifications)\n    ->orderBy('created_at' , 'desc')\n    ->where('brand_ids' , '=' , '2')\n$result  = $posts->get();\n```\n\nI want this line\n\n```\n       ->where('brand_id' , '=' , '2')\n```\n\nto be added to the whole union, but it is added only to one of the queries.\n"},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/266439556","html_url":"https://github.com/laravel/framework/issues/13666#issuecomment-266439556","issue_url":"https://api.github.com/repos/laravel/framework/issues/13666","id":266439556,"user":{"login":"vlakoff","id":544424,"avatar_url":"https://avatars.githubusercontent.com/u/544424?v=3","gravatar_id":"","url":"https://api.github.com/users/vlakoff","html_url":"https://github.com/vlakoff","followers_url":"https://api.github.com/users/vlakoff/followers","following_url":"https://api.github.com/users/vlakoff/following{/other_user}","gists_url":"https://api.github.com/users/vlakoff/gists{/gist_id}","starred_url":"https://api.github.com/users/vlakoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlakoff/subscriptions","organizations_url":"https://api.github.com/users/vlakoff/orgs","repos_url":"https://api.github.com/users/vlakoff/repos","events_url":"https://api.github.com/users/vlakoff/events{/privacy}","received_events_url":"https://api.github.com/users/vlakoff/received_events","type":"User","site_admin":false},"created_at":"2016-12-12T14:08:51Z","updated_at":"2016-12-12T14:08:51Z","body":"I guess this issue can be closed, doesn't it?"}}
{"actor":{"display_login":"vlakoff"}}