Registierung Korrekturen

This commit is contained in:
Kevin Adametz 2020-04-29 20:06:51 +02:00
parent 8e4bb0c2f6
commit d8b5206031
70 changed files with 1192 additions and 569 deletions

View file

@ -114,10 +114,15 @@ class User extends Authenticatable
*
* @var array
*/
protected $fillable = [
'email', 'password', 'token',
];
protected $casts = [
'settings' => 'array',
];
/**
* The attributes that should be hidden for arrays.
*
@ -242,6 +247,10 @@ class User extends Authenticatable
public function isAboOption(){
return ($this->abo_options && $this->account && $this->account->payment_data) ? true : false;
}
public function isActive(){
return ($this->active == 1 && $this->blocked == 0) ? true : false;
}
public function isActiveAccount(){
return $this->payment_account ? Carbon::parse($this->payment_account)->gt(Carbon::now()) : false;
}
@ -336,8 +345,20 @@ class User extends Authenticatable
}
public function setSetting(array $revisions, bool $save = true){
if(!$this->settings){
$this->settings = [];
}
$this->settings = array_merge($this->settings, $revisions);
if ($save) {
$this->save();
}
return $this;
}
public function getSetting($key, $default = null){
return isset($this->settings[$key]) ? $this->settings[$key] : $default;
}
/**
* @return string