League Settings View
This commit is contained in:
parent
7bfba61602
commit
96101cb05d
6 changed files with 146 additions and 15 deletions
53
pfosten/app/Http/Controllers/Leagues/LeagueController.php
Normal file
53
pfosten/app/Http/Controllers/Leagues/LeagueController.php
Normal 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'));
|
||||
}
|
||||
}
|
||||
17
pfosten/app/Http/Controllers/Leagues/MatchController.php
Normal file
17
pfosten/app/Http/Controllers/Leagues/MatchController.php
Normal 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
|
||||
{
|
||||
//
|
||||
}
|
||||
14
pfosten/app/leagues/League.php
Normal file
14
pfosten/app/leagues/League.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App\leagues;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class League extends Model
|
||||
{
|
||||
protected $table ='leagues';
|
||||
protected $fillable = [
|
||||
'id','season_id','rank','subrank','start_round_id','name'
|
||||
];
|
||||
//
|
||||
}
|
||||
14
pfosten/app/leagues/Match.php
Normal file
14
pfosten/app/leagues/Match.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App\leagues;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Match extends Model
|
||||
{
|
||||
protected $table ='leagues_matches';
|
||||
protected $fillable = [
|
||||
'id','league_id','user1_id','user2_idsubrank','start_round_id','name'
|
||||
];
|
||||
//
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue