public function catalogue() { $teamId = Input::get('teamId'); $status = Input::get('status'); $collection = Match::with(['homeTournamentTeam.team', 'awayTournamentTeam.team'])->where('tournamentId', Input::get('tournamentId'))->orderBy('round')->orderBy('id'); if ($status) { $collection->where('status', $status); } if ($teamId) { $collection->where(function ($query) use($teamId) { $query->where('homeTournamentTeamId', $teamId)->orWhere('awayTournamentTeamId', $teamId); }); } return $this->response->collection($collection->get(), new MatchTransformer(), 'matches'); }
public function standings() { $serializer = new StandingsSerializer(); $collection = Match::with(['homeTournamentTeam.team', 'awayTournamentTeam.team'])->where(['tournamentId' => Input::get('tournamentId')]); return $this->response->collection($serializer->collection($collection->get()), new StandingsTransformer(), 'standing'); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $matches = Match::with(['homeTournamentTeam.team', 'awayTournamentTeam.team'])->get(); return view('match.index', compact('matches')); }