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

@ -8,8 +8,10 @@ use App\Season;
use App\Payment;
use App\Round;
use App\Game;
use Carbon;
use Log;
use DB;
class User extends Authenticatable
{
@ -207,18 +209,14 @@ class User extends Authenticatable
$user->save();
}
// Selektiert nur die "Heimspiele"
public static function getMatches($user_id, $league_id) {
$matches = DB::table('leagues_matches')->where('league_id', '=', $league_id)->where('user1_id','=',$user_id)->get();
return $matches;
}
public static function hasMatched($user1_id, $user2_id, $league_id) {
$matches = User::getMatches($user1_id, $league_id);
foreach($matches as $match) {
if ($match->user1_id == $user1_id && $match->user2_id == $user2_id) return true;
public static function getNames() {
$users=User::getActives();
$usernames = array();
foreach($users as $user) {
$usernames[$user->id] = $user->name;
}
return false;
return $usernames;
}