Working on Qualification Pairings
This commit is contained in:
parent
9c0f94758d
commit
a66189ca00
19 changed files with 9005 additions and 237 deletions
|
|
@ -1,12 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\leagues;
|
||||
namespace App\Leagues;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use App\Season;
|
||||
|
||||
use DB;
|
||||
use Log;
|
||||
|
||||
class League extends Model
|
||||
{
|
||||
|
||||
const RANK_LEAGUE1 = 1;
|
||||
const RANK_LEAGUE2 = 2;
|
||||
const RANK_LEAGUE3 = 3;
|
||||
const RANK_QUALIFICATION = 4;
|
||||
|
||||
protected $table ='leagues';
|
||||
protected $fillable = [
|
||||
'id','season_id','is_qualification','rank','subrank','start_round_id','round_count','name'
|
||||
|
|
@ -26,7 +36,21 @@ class League extends Model
|
|||
}
|
||||
|
||||
public static function getMemberCount($league_id) {
|
||||
$members = DB::table('leagues_matches')->where('league_id','=',$league_id)->get();
|
||||
$members = DB::table('leagues_members')->where('league_id','=',$league_id)->get();
|
||||
return sizeof($members);
|
||||
}
|
||||
|
||||
|
||||
public static function getNames() {
|
||||
$season = Season::getCurrent();
|
||||
|
||||
$leagues = League::where('season_id','=',$season->id)->orderBy('rank')->orderBy('name')->get();
|
||||
|
||||
$leagueNames = array();
|
||||
foreach($leagues as $league) {
|
||||
$leagueNames[$league->id] = $league->name;
|
||||
}
|
||||
return $leagueNames;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue