mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-28 11:00:39 +00:00
event implementation
This commit is contained in:
@@ -49,8 +49,8 @@ class CreateNewUserAction extends Controller
|
||||
$user
|
||||
->settings()
|
||||
->create([
|
||||
'name' => $request->input('name'),
|
||||
'storage_capacity' => $settings['storage_default'],
|
||||
'name' => $request->input('name'),
|
||||
'max_storage_amount' => $settings['storage_default'],
|
||||
]);
|
||||
|
||||
UserSettings::reguard();
|
||||
|
||||
@@ -74,7 +74,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
'name',
|
||||
'role',
|
||||
'created_at',
|
||||
'storage_capacity',
|
||||
'max_storage_amount',
|
||||
];
|
||||
|
||||
public $incrementing = false;
|
||||
@@ -101,10 +101,10 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
}
|
||||
|
||||
return [
|
||||
'used' => (float) get_storage_fill_percentage($this->usedCapacity, $this->settings->storage_capacity),
|
||||
'used_formatted' => get_storage_fill_percentage($this->usedCapacity, $this->settings->storage_capacity) . '%',
|
||||
'capacity' => $this->settings->storage_capacity,
|
||||
'capacity_formatted' => format_gigabytes($this->settings->storage_capacity),
|
||||
'used' => (float) get_storage_fill_percentage($this->usedCapacity, $this->settings->max_storage_amount),
|
||||
'used_formatted' => get_storage_fill_percentage($this->usedCapacity, $this->settings->max_storage_amount) . '%',
|
||||
'capacity' => $this->settings->max_storage_amount,
|
||||
'capacity_formatted' => format_gigabytes($this->settings->max_storage_amount),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class UserSettings extends Model
|
||||
|
||||
protected $guarded = [
|
||||
'id',
|
||||
'storage_capacity',
|
||||
'max_storage_amount',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,15 +20,15 @@ class UserResource extends JsonResource
|
||||
'id' => $this->id,
|
||||
'type' => 'user',
|
||||
'attributes' => [
|
||||
'storage_capacity' => $this->settings->storage_capacity,
|
||||
'email' => is_demo() ? obfuscate_email($this->email) : $this->email,
|
||||
'role' => $this->role,
|
||||
'two_factor_authentication' => $this->two_factor_secret ? true : false,
|
||||
'folders' => $this->folder_tree,
|
||||
'storage' => $this->storage,
|
||||
'created_at_formatted' => format_date($this->created_at, '%d. %B. %Y'),
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
'max_storage_amount' => $this->settings->max_storage_amount,
|
||||
'email' => is_demo() ? obfuscate_email($this->email) : $this->email,
|
||||
'role' => $this->role,
|
||||
'two_factor_authentication' => $this->two_factor_secret ? true : false,
|
||||
'folders' => $this->folder_tree,
|
||||
'storage' => $this->storage,
|
||||
'created_at_formatted' => format_date($this->created_at, '%d. %B. %Y'),
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
],
|
||||
'relationships' => [
|
||||
'settings' => [
|
||||
|
||||
@@ -47,29 +47,29 @@ class UserStorageResource extends JsonResource
|
||||
'type' => 'storage',
|
||||
'attributes' => [
|
||||
'used' => Metric::bytes($this->usedCapacity)->format(),
|
||||
'capacity' => format_gigabytes($this->settings->storage_capacity),
|
||||
'percentage' => (float) get_storage_fill_percentage($this->usedCapacity, $this->settings->storage_capacity),
|
||||
'capacity' => format_gigabytes($this->settings->max_storage_amount),
|
||||
'percentage' => (float) get_storage_fill_percentage($this->usedCapacity, $this->settings->max_storage_amount),
|
||||
],
|
||||
'meta' => [
|
||||
'images' => [
|
||||
'used' => Metric::bytes($images)->format(),
|
||||
'percentage' => (float) get_storage_fill_percentage($images, $this->settings->storage_capacity),
|
||||
'percentage' => (float) get_storage_fill_percentage($images, $this->settings->max_storage_amount),
|
||||
],
|
||||
'audios' => [
|
||||
'used' => Metric::bytes($audios)->format(),
|
||||
'percentage' => (float) get_storage_fill_percentage($audios, $this->settings->storage_capacity),
|
||||
'percentage' => (float) get_storage_fill_percentage($audios, $this->settings->max_storage_amount),
|
||||
],
|
||||
'videos' => [
|
||||
'used' => Metric::bytes($videos)->format(),
|
||||
'percentage' => (float) get_storage_fill_percentage($videos, $this->settings->storage_capacity),
|
||||
'percentage' => (float) get_storage_fill_percentage($videos, $this->settings->max_storage_amount),
|
||||
],
|
||||
'documents' => [
|
||||
'used' => Metric::bytes($documents)->format(),
|
||||
'percentage' => (float) get_storage_fill_percentage($documents, $this->settings->storage_capacity),
|
||||
'percentage' => (float) get_storage_fill_percentage($documents, $this->settings->max_storage_amount),
|
||||
],
|
||||
'others' => [
|
||||
'used' => Metric::bytes($others)->format(),
|
||||
'percentage' => (float) get_storage_fill_percentage($others, $this->settings->storage_capacity),
|
||||
'percentage' => (float) get_storage_fill_percentage($others, $this->settings->max_storage_amount),
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user