Show all player leagues in 1 view, reduce nav Dropdown meny item count

This commit is contained in:
Torsten 2017-11-09 11:53:20 +01:00
parent 02329d5c21
commit c337916a3b
9 changed files with 93 additions and 47 deletions

View file

@ -49,11 +49,27 @@ class Season extends Model
return $seasons[1];
}
public static function hasQualifications($seasonId) {
$leagues = League::where('season_id','=',$seasonId)->get();
foreach($leagues as $league) {
if ($league->rank == League::RANK_QUALIFICATION) return true;
public static function hasQualifications($seasonId=-1) {
return Season::hasLeagueType($seasonId,League::RANK_QUALIFICATION);
}
public static function hasStandardLeague($seasonId=-1) {
return Season::hasLeagueType($seasonId,League::RANK_LEAGUE1);
}
public static function hasLeagueType($seasonId=-1, $ltype) {
$season=null;
if ($seasonId==-1) {
$season = Season::getCurrent();
if (!$season) return false;
$seasonId=$season->id;
}
$leagues = League::where('season_id', '=', $seasonId)->get();
foreach ($leagues as $league) {
if ($league->rank == $ltype) return true;
}
return false;
}
}