handle SubscriptionWasCreated, SubscriptionWasExpired, SubscriptionWasUpdated on VueFileManager backend

This commit is contained in:
Čarodej
2021-11-19 19:53:16 +01:00
parent 6ca84d9041
commit 8faa865fb7
11 changed files with 158 additions and 27 deletions

View File

@@ -1,5 +1,4 @@
<?php
namespace App\Users\Models;
use ByteUnits\Metric;
@@ -93,7 +92,7 @@ class User extends Authenticatable implements MustVerifyEmail
{
$is_storage_limit = get_settings('storage_limitation') ?? 1;
if (!$is_storage_limit) {
if (! $is_storage_limit) {
return [
'used' => $this->usedCapacity,
'used_formatted' => Metric::bytes($this->usedCapacity)->format(),
@@ -101,7 +100,7 @@ class User extends Authenticatable implements MustVerifyEmail
}
return [
'used' => (float)get_storage_fill_percentage($this->usedCapacity, $this->limitations->max_storage_amount),
'used' => (float) get_storage_fill_percentage($this->usedCapacity, $this->limitations->max_storage_amount),
'used_formatted' => get_storage_fill_percentage($this->usedCapacity, $this->limitations->max_storage_amount) . '%',
'capacity' => $this->limitations->max_storage_amount,
'capacity_formatted' => format_gigabytes($this->limitations->max_storage_amount),
@@ -114,7 +113,7 @@ class User extends Authenticatable implements MustVerifyEmail
public function getUsedCapacityAttribute(): int
{
return $this->filesWithTrashed
->map(fn($item) => $item->getRawOriginal())->sum('filesize');
->map(fn ($item) => $item->getRawOriginal())->sum('filesize');
}
/**