hello,
i try change my codeigniter app to laravel and i have this problem in query
i use this query in codeigniter and work fine with me when i try use in laravel not work
$date = date('Y-m-d');
$this->db->select("
season_match.team_id,
(IFNULL(hometeam.play, 0) + IFNULL(vistor.play, 0)) as `play`,
(IFNULL(hometeam.goalDiff, 0) + IFNULL(vistor.goalDiff, 0)) as `goalDiff`,
(IFNULL(hometeam.won, 0) + IFNULL(vistor.won, 0)) as `won`,
(IFNULL(hometeam.lost, 0) + IFNULL(vistor.lost, 0)) as `lost`,
(IFNULL(hometeam.void, 0) + IFNULL(vistor.void, 0)) as `void`,
(IFNULL(hometeam.goals, 0) + IFNULL(vistor.goals, 0)) as `goals`,
(IFNULL(hometeam.goalsin, 0) + IFNULL(vistor.goalsin, 0)) as `goalsin`,
(IFNULL(hometeam.void, 0) + IFNULL(vistor.void, 0)) +
(IFNULL(hometeam.won, 0) + IFNULL(vistor.won, 0)) * 3 as `point`
FROM season_match
LEFT JOIN(
SELECT
hometeam, startTimeUtc,
count(*) as play,
SUM(if(homegoal > awaygoal, 1, 0)) as won,
SUM(if(homegoal < awaygoal, 1, 0)) as lost,
SUM(if(homegoal = awaygoal, 1, 0)) as void,
SUM(homegoal) as goals,
SUM(awaygoal) as goalsin,
SUM(homegoal) - SUM(awaygoal) AS goalDiff,
season,awayteam, homegoal, awaygoal FROM matchs
where `season` = $season
and `startTimeUtc` < '$endtime'
GROUP by matchs.hometeam
) as hometeam on hometeam.hometeam = season_match.team_id
LEFT JOIN(
SELECT
hometeam, startTimeUtc,
count(*) as play,
SUM(if(homegoal < awaygoal, 1, 0)) as won,
SUM(if(homegoal > awaygoal, 1, 0)) as lost,
SUM(if(homegoal = awaygoal, 1, 0)) as void,
SUM(awaygoal) as goals,
SUM(homegoal) as goalsin,
SUM(awaygoal) - SUM(homegoal) AS goalDiff,
season,awayteam, homegoal, awaygoal from matchs
where `season` = $season
and `startTimeUtc` < '$endtime'
GROUP by matchs.awayteam
) as vistor on vistor.awayteam = season_match.team_id")
->order_by('point', 'DESC')
// ->order_by('allgoals', 'DESC')
->order_by('won', 'DESC')
// ->order_by('void', 'DESC')
// ->order_by('lost', 'DESC')
->order_by('goalDiff', 'DESC')
->order_by('goals', 'DESC')
// ->order_by('play', 'DESC')
->join('teams', 'teams.id = season_match.team_id', 'left')
->where('season_match.season_id', $season);
$team_data = $this->db->get();
$data['table'] = $team_data->result();
how i can use this query in laravel
thanks