mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 08:12:15 +00:00
team invitation notification with broadcasting
This commit is contained in:
@@ -898,7 +898,7 @@ class SetupDevEnvironment extends Command
|
||||
])
|
||||
->each(function ($file) use ($users, $financeDocumentsFolder, $otherDocuments) {
|
||||
$user = $users[rand(0, 2)];
|
||||
$folder = [$financeDocumentsFolder, $otherDocuments][rand(0,1)];
|
||||
$folder = [$financeDocumentsFolder, $otherDocuments][rand(0, 1)];
|
||||
|
||||
$basename = Str::random(12) . '-' . $file['basename'];
|
||||
|
||||
@@ -1120,7 +1120,7 @@ class SetupDevEnvironment extends Command
|
||||
'Smart Watch 3D Device Pack for Element 3D.mp4',
|
||||
])
|
||||
->each(function ($file) use ($users, $videos) {
|
||||
$user = $users[rand(0,1)];
|
||||
$user = $users[rand(0, 1)];
|
||||
|
||||
$basename = Str::random(12) . '-' . $file;
|
||||
|
||||
@@ -1151,7 +1151,7 @@ class SetupDevEnvironment extends Command
|
||||
->each(function ($file) use ($users, $folder) {
|
||||
$basename = Str::random(12) . '-' . $file['basename'];
|
||||
|
||||
$user = $users[rand(0,1)];
|
||||
$user = $users[rand(0, 1)];
|
||||
|
||||
// Copy file into app storage
|
||||
Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, 'private');
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Fruitcake\Cors\HandleCors;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Users\Controllers\Authentication;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Users\Resources;
|
||||
|
||||
use Domain\Notifications\Resources\NotificationCollection;
|
||||
use Domain\Folders\Resources\FolderCollection;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use App\Users\Actions\FormatUsageEstimatesAction;
|
||||
use Domain\Notifications\Resources\NotificationCollection;
|
||||
use VueFileManager\Subscription\Domain\Credits\Resources\BalanceResource;
|
||||
use VueFileManager\Subscription\Domain\CreditCards\Resources\CreditCardCollection;
|
||||
use VueFileManager\Subscription\Domain\BillingAlerts\Resources\BillingAlertResource;
|
||||
@@ -49,16 +48,16 @@ class UserResource extends JsonResource
|
||||
'settings' => new SettingsResource($this->settings),
|
||||
'favourites' => new FolderCollection($this->favouriteFolders),
|
||||
'creditCards' => new CreditCardCollection($this->creditCards),
|
||||
$this->mergeWhen($this->hasSubscription(), fn() => [
|
||||
$this->mergeWhen($this->hasSubscription(), fn () => [
|
||||
'subscription' => new SubscriptionResource($this->subscription),
|
||||
]),
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn() => [
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn () => [
|
||||
'balance' => new BalanceResource($this->balance),
|
||||
]),
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn() => [
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn () => [
|
||||
'alert' => new BillingAlertResource($this->billingAlert),
|
||||
]),
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn() => [
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn () => [
|
||||
'failedPayments' => new FailedPaymentsCollection($this->failedPayments),
|
||||
]),
|
||||
],
|
||||
@@ -70,13 +69,13 @@ class UserResource extends JsonResource
|
||||
'canCreateTeamFolder' => $this->canCreateTeamFolder(),
|
||||
'canInviteTeamMembers' => $this->canInviteTeamMembers(),
|
||||
],
|
||||
$this->mergeWhen($isFixedSubscription, fn() => [
|
||||
$this->mergeWhen($isFixedSubscription, fn () => [
|
||||
'limitations' => $this->limitations->summary(),
|
||||
]),
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn() => [
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn () => [
|
||||
'usages' => $this->getUsageEstimates(),
|
||||
]),
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn() => [
|
||||
$this->mergeWhen($isMeteredSubscription && $this->hasSubscription(), fn () => [
|
||||
'totalDebt' => [
|
||||
'formatted' => format_currency($this->failedPayments->sum('amount'), $this->subscription->plan->currency),
|
||||
'amount' => $this->failedPayments->sum('amount'),
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Users\Resources;
|
||||
|
||||
use ByteUnits\Metric;
|
||||
use Carbon\CarbonPeriod;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -23,18 +20,18 @@ class UserStorageResource extends JsonResource
|
||||
|
||||
$totalCapacity = match (get_settings('subscription_type')) {
|
||||
'metered' => $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' => [
|
||||
@@ -47,23 +44,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),
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -134,12 +131,12 @@ class UserStorageResource extends JsonResource
|
||||
->where('created_at', '>', $period)
|
||||
->orderBy('created_at')
|
||||
->get(['upload', 'download', 'created_at'])
|
||||
->each(fn($record) => $record->created_at = format_date($record->created_at, 'd. M. Y'))
|
||||
->each(fn ($record) => $record->created_at = format_date($record->created_at, 'd. M. Y'))
|
||||
->keyBy('created_at');
|
||||
|
||||
$mappedTrafficRecords = mapTrafficRecords($trafficRecords);
|
||||
|
||||
$upload = $mappedTrafficRecords->map(fn($record) => [
|
||||
$upload = $mappedTrafficRecords->map(fn ($record) => [
|
||||
'created_at' => $record->created_at,
|
||||
'amount' => Metric::bytes($record->upload)->format(),
|
||||
'percentage' => intval($uploadMax) !== 0
|
||||
@@ -147,7 +144,7 @@ class UserStorageResource extends JsonResource
|
||||
: 0,
|
||||
]);
|
||||
|
||||
$download = $mappedTrafficRecords->map(fn($record) => [
|
||||
$download = $mappedTrafficRecords->map(fn ($record) => [
|
||||
'created_at' => $record->created_at,
|
||||
'amount' => Metric::bytes($record->download)->format(),
|
||||
'percentage' => intval($downloadMax) !== 0
|
||||
|
||||
Reference in New Issue
Block a user