Kundenhoheit

This commit is contained in:
Kevin Adametz 2020-05-06 15:43:53 +02:00
parent d8b5206031
commit dc63fa9fb2
52 changed files with 2436 additions and 557 deletions

View file

@ -167,18 +167,38 @@ class User extends Authenticatable
return $this->hasOne('App\Models\UserShop', 'user_id', 'id');
}
public function user_update_email()
{
return $this->hasMany('App\Models\UserUpdateEmail', 'user_id', 'id');
}
public function member_shopping_orders()
{
return $this->hasMany('App\Models\ShoppingOrder', 'member_id', 'id');
}
public function member_shopping_users()
{
return $this->hasMany('App\Models\ShoppingUser', 'member_id', 'id');
}
public function getMUserSponsor(){
if($this->user_sponsor && $this->user_sponsor->account){
return $this->user_sponsor->account->first_name." ".$this->user_sponsor->account->last_name." | ".$this->user_sponsor->email;
}
}
public function getFullName($email=true){
$ret = "";
if($this->account){
$ret = $this->account->first_name." ".$this->account->last_name;
}
if($email && $this->id > 1){
$ret .= " | ".$this->email;
}
return $ret;
}
/**
* @return bool
*/
@ -259,8 +279,7 @@ class User extends Authenticatable
return $this->payment_shop ? Carbon::parse($this->payment_shop)->gt(Carbon::now()) : false;
}
public function isRenewalAccount()
{
public function isRenewalAccount(){
if ($this->payment_account) {
return Carbon::parse($this->payment_account)->modify('-'.(config('mivita.renewal_days')+1).' days')->lt(Carbon::now());
}