-
-
+
\ No newline at end of file
diff --git a/src/App/Users/Resources/UserStorageResource.php b/src/App/Users/Resources/UserStorageResource.php
index 8010cee4..5c473f46 100644
--- a/src/App/Users/Resources/UserStorageResource.php
+++ b/src/App/Users/Resources/UserStorageResource.php
@@ -1,4 +1,5 @@
$this->usedCapacity / 1000000000,
- 'fixed' => $this->limitations->max_storage_amount,
- default => $this->limitations->max_storage_amount,
+ 'fixed' => $this->limitations->max_storage_amount,
+ default => $this->limitations->max_storage_amount,
};
return [
'data' => [
- 'id' => (string) $this->id,
+ 'id' => (string)$this->id,
'type' => 'storage',
'attributes' => [
'used' => Metric::bytes($this->usedCapacity)->format(),
'capacity' => format_gigabytes($totalCapacity),
- 'percentage' => (float) get_storage_percentage($this->usedCapacity, $totalCapacity),
+ 'percentage' => (float)get_storage_percentage($this->usedCapacity, $totalCapacity),
],
'meta' => [
'traffic' => [
@@ -44,23 +45,23 @@ class UserStorageResource extends JsonResource
],
'images' => [
'used' => Metric::bytes($images)->format(),
- 'percentage' => (float) get_storage_percentage($images, $totalCapacity),
+ 'percentage' => (float)get_storage_percentage($images, $totalCapacity),
],
'audios' => [
'used' => Metric::bytes($audios)->format(),
- 'percentage' => (float) get_storage_percentage($audios, $totalCapacity),
+ 'percentage' => (float)get_storage_percentage($audios, $totalCapacity),
],
'videos' => [
'used' => Metric::bytes($videos)->format(),
- 'percentage' => (float) get_storage_percentage($videos, $totalCapacity),
+ 'percentage' => (float)get_storage_percentage($videos, $totalCapacity),
],
'documents' => [
'used' => Metric::bytes($documents)->format(),
- 'percentage' => (float) get_storage_percentage($documents, $totalCapacity),
+ 'percentage' => (float)get_storage_percentage($documents, $totalCapacity),
],
'others' => [
'used' => Metric::bytes($others)->format(),
- 'percentage' => (float) get_storage_percentage($others, $totalCapacity),
+ 'percentage' => (float)get_storage_percentage($others, $totalCapacity),
],
],
],
@@ -132,14 +133,16 @@ class UserStorageResource extends JsonResource
->orderBy('created_at')
->get();
- $upload = $trafficRecords->map(fn ($record) => [
+ $upload = $trafficRecords->map(fn($record) => [
'created_at' => format_date($record->created_at),
- 'amount' => $uploadMax !== 0 ? round(($record->upload / $uploadMax) * 100, 2) : 0,
+ 'percentage' => $uploadMax !== 0 ? round(($record->upload / $uploadMax) * 100, 2) : 0,
+ 'amount' => Metric::bytes($record->upload)->format(),
]);
- $download = $trafficRecords->map(fn ($record) => [
+ $download = $trafficRecords->map(fn($record) => [
'created_at' => format_date($record->created_at),
- 'amount' => $downloadMax !== 0 ? round(($record->download / $downloadMax) * 100, 2) : 0,
+ 'percentage' => $downloadMax !== 0 ? round(($record->download / $downloadMax) * 100, 2) : 0,
+ 'amount' => Metric::bytes($record->download)->format(),
]);
return [$downloadTotal, $uploadTotal, $upload, $download];
diff --git a/src/Domain/Admin/Controllers/Dashboard/GetDashboardDataController.php b/src/Domain/Admin/Controllers/Dashboard/GetDashboardDataController.php
index 419f87a3..5f5df8cf 100644
--- a/src/Domain/Admin/Controllers/Dashboard/GetDashboardDataController.php
+++ b/src/Domain/Admin/Controllers/Dashboard/GetDashboardDataController.php
@@ -1,4 +1,5 @@
Subscription::count(),
],
'disk' => [
- 'used' => $storageUsage,
- 'download' => [
+ 'used' => $storageUsage,
+ 'download' => [
'total' => $downloadTotal,
'records' => $download,
],
- 'upload' => [
+ 'upload' => [
'total' => $uploadTotal,
'records' => $upload,
],
@@ -65,14 +66,16 @@ class GetDashboardDataController extends Controller
->groupBy('created_at')
->get();
- $upload = $trafficRecords->map(fn ($record) => [
- 'created_at' => format_date($record->created_at, '%d. %B. %Y'),
- 'amount' => intval($trafficRecords->max('upload')) !== 0 ? round(($record->upload / $trafficRecords->max('upload')) * 100, 2) : 0,
+ $upload = $trafficRecords->map(fn($record) => [
+ 'created_at' => format_date($record->created_at, '%d. %B'),
+ 'percentage' => intval($trafficRecords->max('upload')) !== 0 ? round(($record->upload / $trafficRecords->max('upload')) * 100, 2) : 0,
+ 'amount' => Metric::bytes($record->upload)->format(),
]);
- $download = $trafficRecords->map(fn ($record) => [
- 'created_at' => format_date($record->created_at, '%d. %B. %Y'),
- 'amount' => intval($trafficRecords->max('download')) !== 0 ? round(($record->download / $trafficRecords->max('download')) * 100, 2) : 0,
+ $download = $trafficRecords->map(fn($record) => [
+ 'created_at' => format_date($record->created_at, '%d. %B'),
+ 'percentage' => intval($trafficRecords->max('download')) !== 0 ? round(($record->download / $trafficRecords->max('download')) * 100, 2) : 0,
+ 'amount' => Metric::bytes($record->download)->format(),
]);
// Get total download/upload