mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-28 19:10:40 +00:00
user management v1.6-alpha.1
This commit is contained in:
+26
-2
@@ -63,7 +63,7 @@ class User extends Authenticatable
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password', 'avatar',
|
||||
'name', 'email', 'password', 'avatar', 'role',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -86,9 +86,23 @@ class User extends Authenticatable
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'used_capacity'
|
||||
'used_capacity', 'storage'
|
||||
];
|
||||
|
||||
/**
|
||||
* Get user used storage details
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getStorageAttribute() {
|
||||
|
||||
return [
|
||||
'used' => (float) get_storage_fill_percentage($this->used_capacity, $this->settings->storage_capacity),
|
||||
'capacity' => $this->settings->storage_capacity,
|
||||
'capacity_formatted' => Metric::gigabytes($this->settings->storage_capacity)->format(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user used storage capacity in bytes
|
||||
*
|
||||
@@ -167,4 +181,14 @@ class User extends Authenticatable
|
||||
|
||||
return $this->hasMany(FileManagerFile::class)->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user attributes
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function settings() {
|
||||
|
||||
return $this->hasOne(UserSettings::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user