deleted) { Payment::set_payment_date($user->id, $seasonId, '01.01.2017'); $cnt+=1;} } return $cnt." Users in season_id ".$seasonId." set to paid"; } public static function fillSeason($seasonId=-1) { error_log("creating all tipps started"); Tipp::createAllTips(); error_log("creating all tipps completed"); $users = User::all(); if ($seasonId==-1) { $season = Season::getCurrent(); $seasonId = $season->id; } error_log("setting payment started"); Test::paySeason($seasonId); error_log("setting payment completed"); error_log("Users: ".sizeof($users)); // Spielergebnisse faken $rounds=Round::where('season_id','=',$seasonId)->get(); error_log("Rounds: ".sizeof($rounds)); foreach ($rounds as $round) { $games=Game::where('round_id','=',$round->id)->get(); $jokerSet=false; error_log("Faking Tipps and game results for all users for: ".$round->name); foreach ($games as $game) { $game->score1=random_int(0,3); $game->score2=random_int(0,3); $game->kickoff= Carbon\Carbon::now(); $game->save(); foreach ($users as $user) { // Tipps faken $tipp=Tipp::where('game_id','=',$game->id)->where('user_id','=',$user->id)->first(); $tipp->score1 = random_int(0,3); $tipp->score2 = random_int(0,3); if (!$jokerSet) { $tipp->joker=true; } $tipp->save(); } $jokerSet=true; } } } }