Added HTML Helpers from Laravelcollective
This commit is contained in:
parent
0736ecf29f
commit
b5c1f40a45
31 changed files with 614 additions and 220 deletions
|
|
@ -4,6 +4,8 @@ namespace App;
|
|||
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use App\Season;
|
||||
use App\Payment;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
|
|
@ -26,4 +28,37 @@ class User extends Authenticatable
|
|||
protected $hidden = [
|
||||
'password', 'remember_token',
|
||||
];
|
||||
|
||||
|
||||
// Only the current season.
|
||||
public static function is_season_paid($user_id) {
|
||||
$retval="Ja";
|
||||
if (User::payment_date($user_id, Season::getCurrent()->id)==null) { $retval="Nein"; }
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
public static function payment_date($user_id,$season_id) {
|
||||
$season = Season::getCurrent();
|
||||
if ($season) {
|
||||
$payment = Payment::where([
|
||||
['user_id', '=', $user_id],
|
||||
['season_id', '=', $season->id]
|
||||
])->first();
|
||||
if ($payment) {
|
||||
if ($payment->paid_date) {
|
||||
return $payment->paid_date;
|
||||
}
|
||||
} else {
|
||||
$payment= Payment::create([
|
||||
'user_id' => $user_id,
|
||||
'season_id'=> $season->id,
|
||||
'paid_date'=> null
|
||||
]);
|
||||
$payment->save();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue