event implementation

This commit is contained in:
Čarodej
2021-11-19 17:08:49 +01:00
parent 496a6ea5a7
commit 7c5cb79677
32 changed files with 135 additions and 121 deletions

View File

@@ -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),
],
],
],