[admin] add setting backup

This commit is contained in:
xiaomlove
2021-05-14 20:41:43 +08:00
parent 6c85176e2f
commit 47f64f2c5c
23 changed files with 787 additions and 39 deletions

View File

@@ -24,4 +24,14 @@ class Invite extends NexusModel
return self::$validInfo[$this->valid]['text'] ?? '';
}
public function inviter_user()
{
return $this->belongsTo(User::class, 'inviter');
}
public function invitee_user()
{
return $this->belongsTo(User::class, 'invitee_register_uid');
}
}

View File

@@ -65,7 +65,6 @@ class User extends Authenticatable
}
/**
* 为数组 / JSON 序列化准备日期。
*
@@ -82,7 +81,9 @@ class User extends Authenticatable
*
* @var array
*/
protected $fillable = ['username', 'email', 'passhash', 'secret', 'editsecret', 'added'];
protected $fillable = [
'username', 'email', 'passhash', 'secret', 'stylesheet', 'editsecret', 'added', 'modcomment', 'enabled', 'status'
];
/**
* The attributes that should be hidden for arrays.
@@ -105,7 +106,7 @@ class User extends Authenticatable
public static $commonFields = [
'id', 'username', 'email', 'class', 'status', 'added', 'avatar',
'uploaded', 'downloaded', 'seedbonus', 'seedtime', 'leechtime',
'invited_by',
'invited_by', 'enabled',
];
public function checkIsNormal(array $fields = ['status', 'enabled'])
@@ -160,7 +161,9 @@ class User extends Authenticatable
if (!$this->exists) {
throw new \RuntimeException('This mehtod only works when user exists!');
}
$update['modcomment'] = DB::raw("concat_ws('\n', $modComment, modcomment)");
//@todo how to do prepare bindings here ?
$modComment = addslashes($modComment);
$update['modcomment'] = DB::raw("concat_ws('\n', '$modComment', modcomment)");
return $this->update($update);
}