Working on Qualification Pairings

This commit is contained in:
Torsten 2017-09-22 17:40:48 +02:00
parent 9c0f94758d
commit a66189ca00
19 changed files with 9005 additions and 237 deletions

View file

@ -4,6 +4,8 @@ namespace App\Leagues;
use Illuminate\Database\Eloquent\Model;
use App\User;
class LeagueMember extends Model
{
protected $table ='leagues_members';
@ -11,4 +13,19 @@ class LeagueMember extends Model
'id','user_id','league_id'
];
//
public static function getMembers($league_id) {
$members =LeagueMember::where('league_id','=',$league_id)->orderBy('id')->get();
return $members;
}
public static function playsInRound($userId, $roundId, $leagueId) {
$matches1 = Match::where('user1_id','=',$userId)->where('round_id','=',$roundId)->where('league_id','=',$leagueId)->get();
if (sizeof($matches1)>0) return true;
$matches2 = Match::where('user2_id','=',$userId)->where('round_id','=',$roundId)->where('league_id','=',$leagueId)->get();
return sizeof($matches2)>0;
}
}