01 2020
This commit is contained in:
parent
f117f79bb9
commit
3711fcc8d0
101 changed files with 4027 additions and 918 deletions
61
app/User.php
61
app/User.php
|
|
@ -80,6 +80,12 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User wherePaymentAccount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User wherePaymentShop($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereWizard($value)
|
||||
* @property int|null $m_level
|
||||
* @property int|null $m_sponsor
|
||||
* @property-read \App\Models\UserLevel|null $user_level
|
||||
* @property-read \App\User|null $user_sponsor
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereMLevel($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereMSponsor($value)
|
||||
*/
|
||||
class User extends Authenticatable
|
||||
{
|
||||
|
|
@ -110,13 +116,11 @@ class User extends Authenticatable
|
|||
];
|
||||
|
||||
|
||||
public function account()
|
||||
{
|
||||
public function account(){
|
||||
return $this->belongsTo('App\Models\UserAccount', 'account_id');
|
||||
}
|
||||
|
||||
public function user_level()
|
||||
{
|
||||
public function user_level(){
|
||||
return $this->belongsTo('App\Models\UserLevel', 'm_level');
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +129,10 @@ class User extends Authenticatable
|
|||
|
||||
}
|
||||
|
||||
public function files(){
|
||||
return $this->hasMany('App\Models\File', 'user_id', '');
|
||||
|
||||
}
|
||||
|
||||
public function shop()
|
||||
{
|
||||
|
|
@ -203,6 +210,42 @@ class User extends Authenticatable
|
|||
|
||||
|
||||
|
||||
public function isActiveAccount(){
|
||||
return $this->payment_account ? Carbon::parse($this->payment_account)->gt(Carbon::now()) : false;
|
||||
}
|
||||
|
||||
public function isActiveShop(){
|
||||
return $this->payment_shop ? Carbon::parse($this->payment_shop)->gt(Carbon::now()) : false;
|
||||
}
|
||||
|
||||
|
||||
public function daysActiveAccount(){
|
||||
return Carbon::now()->diffInDays(Carbon::parse($this->payment_account), false);
|
||||
}
|
||||
|
||||
public function modifyActiveAccount($add = "1 year"){
|
||||
return Carbon::parse($this->payment_account)->modify($add)->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
public function daysHumansActiveAccount(){
|
||||
Carbon::setLocale(\App::getLocale());
|
||||
return Carbon::now()->diffForHumans(Carbon::parse($this->payment_account));
|
||||
}
|
||||
|
||||
public function daysActiveShop(){
|
||||
return Carbon::now()->diffInDays(Carbon::parse($this->payment_shop), false);
|
||||
}
|
||||
|
||||
public function modifyActiveShop($add = "1 year"){
|
||||
return Carbon::parse($this->payment_shop)->modify($add)->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
public function daysHumansActiveShop(){
|
||||
Carbon::setLocale(\App::getLocale());
|
||||
return Carbon::now()->diffForHumans(Carbon::parse($this->payment_shop));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -244,6 +287,16 @@ class User extends Authenticatable
|
|||
return Carbon::parse($this->attributes['payment_shop'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
public function getReleaseAccountFormat($time = true){
|
||||
if(!$this->attributes['release_account']){ return ""; }
|
||||
if(!$time){
|
||||
return Carbon::parse($this->attributes['release_account'])->format(\Util::formatDateDB());
|
||||
}
|
||||
return Carbon::parse($this->attributes['release_account'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue