コード例 #1
0
ファイル: PagesController.php プロジェクト: sewede/footipp
 public function index()
 {
     $matches = new ShowMatches();
     $matches = $matches->getLatest();
     $nextMatchDate = Matches::where('date', '>', Carbon::now())->select('date')->orderBy('date')->first();
     $SayHello = new SayHello();
     $hello = $SayHello->getHello();
     //Show Rangliste
     $rangliste = DB::table('users')->join('tipps', 'users.id', '=', 'tipps.user_id')->selectRaw('username, sum(tipps.points) as punkte')->groupBy('username')->orderBy('punkte', 'desc')->get();
     return view('pages.index', compact('matches', 'nextMatchDate', 'hello', 'myTipps', 'rangliste'));
 }
コード例 #2
0
ファイル: SpieleController.php プロジェクト: sewede/footipp
 /**
  * Shows Form to save games in database.
  *
  * @vereine array
  */
 public function showGamesForm(Request $request)
 {
     $matchday = $request->input('matchday');
     $league = $request->input('league');
     $season = $request->input('season');
     $getLeague = DB::table('leagues')->select('league')->get();
     $getSeason = DB::table('matches')->select('season')->groupBy('season')->get();
     $getMatchdayCount = Matches::select('matchday')->groupBy('matchday')->get();
     $request->flash();
     $matches = Matches::where('matchday', $matchday)->where('leagues.league', $league)->where('matches.season', $season)->join('clubs as homeclub', 'matches.home_id', '=', 'homeclub.id')->join('clubs as awayclub', 'matches.away_id', '=', 'awayclub.id')->join('leagues', 'matches.league_id', '=', 'leagues.id')->select('matches.*', 'homeclub.club as home', 'awayclub.club as away', 'leagues.league')->orderBy('date')->get();
     return view('admin.savematches', compact('matches', 'getMatchdayCount', 'getLeague', 'getSeason', 'league', 'season'));
 }
コード例 #3
0
ファイル: ShowMatches.php プロジェクト: sewede/footipp
 public function getLatest()
 {
     Carbon::setlocale('de');
     setlocale(LC_TIME, 'de_DE.utf8');
     $userID = Auth::id();
     $userIDExistsInTipps = Tipp::where('user_id', $userID)->first();
     if ($userIDExistsInTipps) {
         $matches = Matches::where('league_id', 1)->where('date', '>', Carbon::now())->where('tipps.user_id', $userID)->join('clubs as homeclub', 'matches.home_id', '=', 'homeclub.id')->join('clubs as awayclub', 'matches.away_id', '=', 'awayclub.id')->join('tipps', 'tipps.match_id', '=', 'matches.id')->select('matches.*', 'homeclub.club as home', 'awayclub.club as away', 'tipps.home_goals as tipp_home', 'tipps.away_goals as tipp_away')->orderBy('date')->get();
         return $matches;
     } else {
         $matches = Matches::where('league_id', 1)->where('date', '>', Carbon::now())->join('clubs as homeclub', 'matches.home_id', '=', 'homeclub.id')->join('clubs as awayclub', 'matches.away_id', '=', 'awayclub.id')->select('matches.*', 'homeclub.club as home', 'awayclub.club as away')->orderBy('date')->get();
         return $matches;
     }
 }