如何在 Laravel 查询生成器中创建它

How create it in Laravel Query builder

SELECT e.match_id, e.team_id 来自 matches 左连接 match_events e 在 e.match_id = matches.id 和 e.match_event_type_id = 1

试试这个,

   $result = DB::table('matches as M')
          ->leftjoin('match_events as E','E.match_id','=','M.id')
          ->where('E.match_event_type_id',1)
          ->select(['E.match_id','E.team_id'])
          ->get();