Delete User, Start of money ranking
This commit is contained in:
parent
054a8d6f63
commit
0b97ae656f
13 changed files with 3330 additions and 36 deletions
|
|
@ -8,6 +8,7 @@ use App\Season;
|
|||
use App\Payment;
|
||||
use App\Round;
|
||||
use App\Game;
|
||||
use Carbon;
|
||||
use Log;
|
||||
|
||||
class User extends Authenticatable
|
||||
|
|
@ -172,5 +173,32 @@ class User extends Authenticatable
|
|||
return true;
|
||||
}
|
||||
|
||||
// aktiv = hat die Saison bezahlt.
|
||||
public static function getActives() {
|
||||
$currentSeason=Season::getCurrent();
|
||||
$users = User::whereNull('deleted')->get();
|
||||
$payments = Payment::where('season_id','=',$currentSeason->id)->get();
|
||||
|
||||
$payref = array();
|
||||
foreach($payments as $payment) {
|
||||
$payref[$payment->user_id]='ok';
|
||||
}
|
||||
|
||||
$userlist=array();
|
||||
foreach($users as $user) {
|
||||
if (array_key_exists($user->id,$payref)) {
|
||||
if($payref[$user->id]) {
|
||||
array_push($userlist,$user);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $userlist;
|
||||
}
|
||||
|
||||
public static function softDelete($user_id) {
|
||||
$user = User::where('id','=',$user_id)->first();
|
||||
if ($user) { $user->deleted = Carbon\Carbon::now();}
|
||||
$user->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue