League Settings View

This commit is contained in:
Torsten 2017-09-09 08:35:39 +02:00
parent 7bfba61602
commit 96101cb05d
6 changed files with 146 additions and 15 deletions

View file

@ -0,0 +1,53 @@
<?php
namespace App\Http\Controllers\Leagues;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Leagues;
use Auth;
use App\Season;
use App\Round;
use App\leagues\League;
class LeagueController extends Controller
{
public function index($season_id) {
if (Auth::guest()) { return redirect("/"); }
if (!Auth::user()->admin) { return redirect("/"); }
$season = Season::where('id','=',$season_id)->first();
$rounds = Round::where('season_id','=',$season_id)->orderBy('id')->get();
$league = League::where('season_id','=',$season_id)->first();
$start_round_name="Einstellen";
$start_round_id=-1;
if ($league) {
if ($league->start_round_id) {
$startRound = Round::where('id','=',$league->start_round_id)->first();
$start_round_name = $startRound->name;
$start_round_id = $startRound->id;
}
}
$startRound=array();
$startRound['id'] = $start_round_id;
$startRound['name'] = $start_round_name;
// Fetch existing leagues
// No leagues: Create Qualification League or Standard League System (including matches)
// necessary input: start_round(_id), round_count
// Delete all leagues & matches
//
return view('leagues.index', compact('season','rounds','startRound'));
}
}

View file

@ -0,0 +1,17 @@
<?php
namespace App\Http\Controllers\Leagues;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Leagues;
use Auth;
use App\Season;
class MatchController extends Controller
{
//
}