This commit is contained in:
Torsten 2017-07-18 14:58:32 +02:00
parent 164bb95eca
commit 30248ae4ef
6039 changed files with 3364 additions and 2287 deletions

19
pfosten/app/Game.php Normal file → Executable file
View file

@ -23,7 +23,21 @@ class Game extends Model
return ($tipp_input_end <= $now);
}
public function hasResult() {
$game = $this;
$hasIt = $game->score1 > -1;
if ($hasIt==false) {
return false;
}
return true;
}
public static function has_result($game_id) {
$game = Game::where('id',$game_id)->first();
$hasIt = $game->score1 > -1;
@ -35,12 +49,13 @@ class Game extends Model
return true;
}
public static function resultString($game_id) {
$game = Game::where('id',$game_id)->first();
$now=Carbon\Carbon::now();
if (!Game::has_result($game_id)) {
if ($game->kickoff>$now) return "Anstoss: " . $game->kickoff;
if (!$game->hasResult()) {
if ($game->kickoff > $now) return "Anstoss: " . $game->kickoff;
$start=Carbon\Carbon::parse($game->kickoff);
$end=$start->addHours(2);