public static function team($teamID, $yearID) { $batters = Batting::leftJoin('master', 'batting.playerID', '=', 'master.playerID')->where('teamID', '=', $teamID)->where('yearID', '=', $yearID); // \Debugbar::info($batters); $grids = BattingsController::grids($batters, 'team'); return $grids; }
public static function player($playerID) { $batters = Batting::leftJoin('master', 'batting.playerID', '=', 'master.playerID')->leftJoin('teams', function ($join) { $join->on('batting.teamID', '=', 'teams.teamID'); $join->on('batting.yearID', '=', 'teams.yearID'); })->select('master.nameLast', 'master.nameFirst', 'teams.name', 'teams.yearID', 'teams.teamID', 'batting.G', 'batting.AB', 'batting.R', 'batting.H', 'batting.HR', 'batting.RBI')->where('batting.playerID', '=', $playerID); $grids = BattingController::grids($batters, 'player'); return $grids; }