mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 08:12:15 +00:00
team folder browsing with static team folder details
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Users\Models\User;
|
||||
use Domain\Teams\Models\TeamFolderInvitation;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Domain\Files\Models\File;
|
||||
use Illuminate\Console\Command;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Domain\Settings\Models\Setting;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Domain\Teams\Models\TeamFolderInvitation;
|
||||
use Domain\Pages\Actions\SeedDefaultPagesAction;
|
||||
use Domain\Settings\Actions\SeedDefaultSettingsAction;
|
||||
use Domain\Localization\Actions\SeedDefaultLanguageAction;
|
||||
@@ -38,8 +37,7 @@ class SetupDevEnvironment extends Command
|
||||
private SeedDefaultSettingsAction $seedDefaultSettings,
|
||||
private SeedDefaultLanguageAction $seedDefaultLanguage,
|
||||
private SeedDefaultPagesAction $seedDefaultPages,
|
||||
)
|
||||
{
|
||||
) {
|
||||
parent::__construct();
|
||||
$this->setUpFaker();
|
||||
}
|
||||
@@ -743,34 +741,36 @@ class SetupDevEnvironment extends Command
|
||||
->get();
|
||||
|
||||
collect([$members[0]->id, $members[1]->id])
|
||||
->each(fn($id) => DB::table('team_folder_members')
|
||||
->insert([
|
||||
'folder_id' => $companyProjectFolder->id,
|
||||
'user_id' => $id,
|
||||
'permission' => 'can-edit',
|
||||
])
|
||||
->each(
|
||||
fn ($id) => DB::table('team_folder_members')
|
||||
->insert([
|
||||
'folder_id' => $companyProjectFolder->id,
|
||||
'user_id' => $id,
|
||||
'permission' => 'can-edit',
|
||||
])
|
||||
);
|
||||
|
||||
collect([$members[2]->id, $members[3]->id])
|
||||
->each(fn($id) => DB::table('team_folder_members')
|
||||
->insert([
|
||||
'folder_id' => $financeDocumentsFolder->id,
|
||||
'user_id' => $id,
|
||||
'permission' => 'can-edit',
|
||||
])
|
||||
->each(
|
||||
fn ($id) => DB::table('team_folder_members')
|
||||
->insert([
|
||||
'folder_id' => $financeDocumentsFolder->id,
|
||||
'user_id' => $id,
|
||||
'permission' => 'can-edit',
|
||||
])
|
||||
);
|
||||
|
||||
// Create invitations
|
||||
collect([$members[4], $members[5]])
|
||||
->each(fn($user) => TeamFolderInvitation::factory()
|
||||
->create([
|
||||
'email' => $user->email,
|
||||
'folder_id' => $companyProjectFolder->id,
|
||||
'status' => 'pending',
|
||||
'permission' => 'can-edit',
|
||||
])
|
||||
->each(
|
||||
fn ($user) => TeamFolderInvitation::factory()
|
||||
->create([
|
||||
'email' => $user->email,
|
||||
'folder_id' => $companyProjectFolder->id,
|
||||
'status' => 'pending',
|
||||
'permission' => 'can-edit',
|
||||
])
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private function create_share_records(): void
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Users\Models;
|
||||
|
||||
use ByteUnits\Metric;
|
||||
@@ -96,7 +95,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(),
|
||||
@@ -104,7 +103,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
}
|
||||
|
||||
return [
|
||||
'used' => (float)get_storage_fill_percentage($this->usedCapacity, $this->settings->storage_capacity),
|
||||
'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),
|
||||
@@ -117,7 +116,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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@ namespace App\Users\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UserSettings extends Model
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user