where([ ['user_id','=',$user_id], ['game_id','=',$game_id] ])->first(); } public static function getScore($tipp_id) { $tipp = Tipp::where('id',$tipp_id)->first(); $game = Game::where('id',$tipp->game_id)->first(); $tippTendenz = $tipp->score1 - $tipp->score2; if ($tippTendenz > 0) {$tippTendenz=1;} if ($tippTendenz < 0) {$tippTendenz=-1;} $gameTendenz = $game->score1 - $game->score2; if ($gameTendenz<0) {$gameTendenz=-1;} if ($gameTendenz>0) {$gameTendenz=1;} $score=0; if ($tippTendenz == $gameTendenz) { $score=1; } if ( ($tipp->score1 == $game->score1) && ($tipp->score2 == $game->score2) ) { $score=2; } if ($tipp->joker==true) { $score = $score *2; } if ($game->score1 == -1) { $score=0; } return $score; } }