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

@ -10,9 +10,12 @@ use App\Round;
use App\Game;
use App\Tipp;
use App\Quota;
use App\Mail\Roundmail;
use DB;
use Auth;
use Log;
use Carbon;
class UsersController extends Controller
@ -23,17 +26,25 @@ class UsersController extends Controller
$currentSeason=Season::getCurrent();
$display_rounds=array();
if ($currentSeason) {
$round_id = Round::getLastCompleteRoundId();
if ($round_id > -1) {
$round = Round::where("id", "=", $round_id)->first();
$report = $round->report;
$rounds = Round::where("id", "<=", $round_id)->get();
foreach($rounds as $round) {
$dpr =array();
$dpr["name"]=$round->name;
$dpr["report"]=$round->report;
array_push($display_rounds, $dpr);
}
$display_rounds = array_reverse($display_rounds);
Log::info("Loaded report:".$report." round-id=".$round_id);
$roundname = $round->name;
} else { Log::info("No round identified. Last Locked=".$round_id); $report="";}
} else {Log::info("No current season");}
return view('main',compact('roundname','report'));
return view('main',compact('roundname','display_rounds'));
}
public function index() {
@ -392,4 +403,17 @@ class UsersController extends Controller
return view('users.show_payouts', compact('payouts','active_user_count','einsatz','currentSeason'));
}
public function mailtest() {
// Works:
// $user = User::where('id','=',1)->first();
// \Mail::to($user)->send(new Roundmail);
$users = User::whereIn('id',array(1,2,7,57))->get();
foreach($users as $user) {
Log::info("Sending Roundmail to: ".$user->name);
\Mail::to($user)->send(new Roundmail);
}
}
}