4
2つのクエリで共用体を作成していますが、結果にwhere句を追加したいが、where句は最初のクエリにのみ追加したい。どうすれば修正できますか?Laravel add where句を結合する結果
$notifications = DB::table('notifications')
->select(DB::raw("notifications.uuid ,notifications.brand_id"))
$posts = DB::table('posts')
->select(DB::raw("posts.uuid ,posts.brand_id"))
->unionAll ($notifications)
->orderBy('created_at' , 'desc')
->where('brand_ids' , '=' , '2')
$result = $posts->get();
私はこのライン
->where('brand_id' , '=' , '2')
は全組合に追加することにしたいが、それは唯一のクエリのいずれかに追加されます。