Start Algorithm for Match creation (incremental version)
This commit is contained in:
parent
7c9d5eef1e
commit
82e60df35f
6 changed files with 8619 additions and 3 deletions
|
|
@ -175,6 +175,7 @@ class User extends Authenticatable
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
// aktiv = hat die Saison bezahlt.
|
||||
public static function getActives() {
|
||||
$currentSeason=Season::getCurrent();
|
||||
|
|
@ -199,10 +200,26 @@ class User extends Authenticatable
|
|||
return $userlist;
|
||||
}
|
||||
|
||||
|
||||
public static function softDelete($user_id) {
|
||||
$user = User::where('id','=',$user_id)->first();
|
||||
if ($user) { $user->deleted = Carbon\Carbon::now();}
|
||||
$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;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue