Working on Roundmail system

This commit is contained in:
Torsten 2017-08-21 16:55:26 +02:00
parent 3fa31921f0
commit 6d7ee1a47c
11 changed files with 224 additions and 24 deletions

View file

@ -130,7 +130,34 @@ class User extends Authenticatable
return $dbDate;
}
public function hello() {
return "Hello";
public static function hasMissingTipp($user_id) {
$round_id = Round::getFirstIncompleteRound();
$games = Game::where('round_id','=',$round_id);
foreach ($games as $game) {
$tipp = Tipp::where('game_id','=',$game->id)->first();
if ($tipp->score1 == -1 || $tipp->score2 == -1) {
return 1;
}
}
return 0;
}
public static function hasMissingJoker($user_id) {
$round_id = Round::getFirstIncompleteRound();
$games = Game::where('round_id','=',$round_id);
$joker=0;
foreach ($games as $game) {
$tipp = Tipp::where('game_id','=',$game->id)->first();
if ($tipp->joker == true) { $joker=1; }
}
if ($joker==1) {
return false;
}
return true;
}
}