$table1 = UserTestDynamicVote::query() ->where('user_id','=',$user_id) ->where('status','=',1) ->select(['id','dynamic_id',DB::raw("'' as content"),DB::raw("'1' as type_num"),'updated_at']); $commentModel = UserTestComment::query() ->where('to_user_id','=',$user_id) ->where('is_vote','=',1) ->where('status','=',1) ->select(['id','comment_id as dynamic_id','content',DB::raw("'2' as type_num"),'updated_at']); $userVoteModel = UserTestDynamicVote::query() ->select(['id','dynamic_id',DB::raw("'' as content"),DB::raw("'3' as type_num"),'updated_at']); $resData = $table1->union($commentModel) ->union($userVoteModel) ->orderBy('updated_at','desc') ->paginate(10);