Update User.php

保存用户信息时 realname 为空自动填充
This commit is contained in:
WxAmd
2020-12-31 15:28:31 +08:00
committed by GitHub
parent c4ba9db9a5
commit fceeda8203

View File

@@ -82,4 +82,9 @@ class User extends BaseModel
{
return $value ?: $this->username;
}
public function setRealnameAttribute($value)
{
$this->attributes['realname'] = $value ?: $this->username;
}
}