leads, sales lists, m_data, orders

This commit is contained in:
Kevin Adametz 2020-01-03 17:44:26 +01:00
parent 1a43060996
commit 7ef7a507c7
26 changed files with 860 additions and 178 deletions

View file

@ -115,20 +115,37 @@ class User extends Authenticatable
return $this->belongsTo('App\Models\UserAccount', 'account_id');
}
public function user_level()
{
return $this->belongsTo('App\Models\UserLevel', 'm_level');
}
public function user_sponsor(){
return $this->belongsTo('App\User', 'm_sponsor');
}
public function shop()
{
return $this->hasOne('App\Models\UserShop', 'user_id', 'id');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function user_update_email()
{
return $this->hasMany('App\Models\UserUpdateEmail', 'user_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;
}
}
/**
* @return bool
*/
@ -210,13 +227,20 @@ class User extends Authenticatable
return Carbon::parse($this->attributes['agreement'])->format(\Util::formatDateTimeDB());
}
public function getPaymentAccountDateFormat(){
public function getPaymentAccountDateFormat($time = true){
if(!$this->attributes['payment_account']){ return ""; }
if(!$time){
return Carbon::parse($this->attributes['payment_account'])->format(\Util::formatDateDB());
}
return Carbon::parse($this->attributes['payment_account'])->format(\Util::formatDateTimeDB());
}
public function getPaymentShopDateFormat(){
public function getPaymentShopDateFormat($time = true){
if(!$this->attributes['payment_shop']){ return ""; }
if(!$time){
return Carbon::parse($this->attributes['payment_shop'])->format(\Util::formatDateDB());
}
return Carbon::parse($this->attributes['payment_shop'])->format(\Util::formatDateTimeDB());
}