I did the conversion, a tip is sometimes not to mount a query this way, because I took complex querys with more than 10 query lines that would become more than 30 and would be bad maintenance, but this is just a personal tip.
Follow the converted query:
$duels = DB::table('tournaments t')
->select('r.id', 'r.name')
->join('duels d', 't.id', '=', 'd.tournament_id')
->join('riders r', function($join){
$join->on('d.rider_a_id','=','r.id');
$join->orOn('d.rider_b_id','=','r.id');
})
->where('t.id', '=', $id)
->get();
Result that she returned to me using the toSql();
:
select `r`.`id`, `r`.`name` from `tournaments t` inner join `duels d` on `t`.`id` = `d`.`tournament_id` inner join `riders r` on `d`.`rider_a_id` = `r`.`id` or `d`.`rider_b_id` = `r`.`id` where `t`.`id` = ?
Test there and give a feedback, as I had no way to test, for more information I will leave the link documentation:
https://laravel.com/docs/5.7/queries