Rangliste almost done
This commit is contained in:
parent
12651fc2e8
commit
43fd8c8cbf
579 changed files with 172489 additions and 127 deletions
|
|
@ -6,11 +6,16 @@ use Illuminate\Http\Request;
|
|||
use App\Season;
|
||||
use App\Round;
|
||||
use App\Game;
|
||||
use App\User;
|
||||
use DB;
|
||||
use Auth;
|
||||
|
||||
class RoundsController extends Controller
|
||||
{
|
||||
public function index() {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
||||
$activeSeason=Season::getCurrent();
|
||||
$rounds =null;
|
||||
|
||||
|
|
@ -28,6 +33,9 @@ class RoundsController extends Controller
|
|||
|
||||
|
||||
public function create() {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
||||
$currentSeason = Season::getCurrent();
|
||||
if ($currentSeason) {
|
||||
return view('rounds.create', compact('currentSeason'));
|
||||
|
|
@ -37,6 +45,8 @@ class RoundsController extends Controller
|
|||
|
||||
|
||||
public function store() {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
||||
// Validate form
|
||||
$this->validate(request(), [
|
||||
|
|
@ -68,28 +78,28 @@ class RoundsController extends Controller
|
|||
'round_id' => $round_id,
|
||||
'team1' => request('game1_team1'),
|
||||
'team2' => request('game1_team2'),
|
||||
'kickoff' => request('game1_kickoff')
|
||||
'kickoff' => User::toDBDate(request('game1_kickoff'))
|
||||
]);
|
||||
|
||||
$game2 = Game::create([
|
||||
'round_id' => $round_id,
|
||||
'team1' => request('game2_team1'),
|
||||
'team2' => request('game2_team2'),
|
||||
'kickoff' => request('game2_kickoff')
|
||||
'kickoff' => User::toDBDate(request('game2_kickoff'))
|
||||
]);
|
||||
|
||||
$game3 = Game::create([
|
||||
'round_id' => $round_id,
|
||||
'team1' => request('game3_team1'),
|
||||
'team2' => request('game3_team2'),
|
||||
'kickoff' => request('game3_kickoff')
|
||||
'kickoff' => User::toDBDate(request('game3_kickoff'))
|
||||
]);
|
||||
|
||||
$game4 = Game::create([
|
||||
'round_id' => $round_id,
|
||||
'team1' => request('game4_team1'),
|
||||
'team2' => request('game4_team2'),
|
||||
'kickoff' => request('game4_kickoff')
|
||||
'kickoff' => User::toDBDate(request('game4_kickoff'))
|
||||
]);
|
||||
// Sign them in
|
||||
|
||||
|
|
@ -105,6 +115,9 @@ class RoundsController extends Controller
|
|||
|
||||
public function storename()
|
||||
{
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
if (!Auth::user()->admin) { return redirect("/"); }
|
||||
|
||||
// Validate form
|
||||
$this->validate(request(), [
|
||||
'round_id' => 'required',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue