mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-24 01:50:38 +00:00
Folder tree dynamic navigator
This commit is contained in:
@@ -121,19 +121,6 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
->sum('filesize');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user full folder tree
|
||||
*/
|
||||
public function getFolderTreeAttribute(): Collection
|
||||
{
|
||||
return Folder::with(['folders.shared', 'shared:token,id,item_id,permission,is_protected,expire_in'])
|
||||
->where('parent_id')
|
||||
->where('team_folder', false)
|
||||
->where('user_id', $this->id)
|
||||
->sortable()
|
||||
->get();
|
||||
}
|
||||
|
||||
public function settings(): HasOne
|
||||
{
|
||||
return $this->hasOne(UserSetting::class);
|
||||
|
||||
@@ -36,7 +36,6 @@ class UserResource extends JsonResource
|
||||
'role' => $this->role,
|
||||
'two_factor_authentication' => $this->two_factor_secret ? true : false,
|
||||
'socialite_account' => $this->password ? false : true,
|
||||
'folders' => $this->folder_tree,
|
||||
'storage' => $this->storage,
|
||||
'created_at' => format_date($this->created_at, '%d. %b. %Y'),
|
||||
'updated_at' => format_date($this->updated_at, '%d. %B. %Y'),
|
||||
|
||||
@@ -134,13 +134,13 @@ class UserStorageResource extends JsonResource
|
||||
->get();
|
||||
|
||||
$upload = $trafficRecords->map(fn($record) => [
|
||||
'created_at' => format_date($record->created_at),
|
||||
'created_at' => format_date($record->created_at, '%d. %B'),
|
||||
'percentage' => $uploadMax !== 0 ? round(($record->upload / $uploadMax) * 100, 2) : 0,
|
||||
'amount' => Metric::bytes($record->upload)->format(),
|
||||
]);
|
||||
|
||||
$download = $trafficRecords->map(fn($record) => [
|
||||
'created_at' => format_date($record->created_at),
|
||||
'created_at' => format_date($record->created_at, '%d. %B'),
|
||||
'percentage' => $downloadMax !== 0 ? round(($record->download / $downloadMax) * 100, 2) : 0,
|
||||
'amount' => Metric::bytes($record->download)->format(),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user