mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-04 05:05:58 +00:00
refactoring
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Users\Models;
|
||||
|
||||
use ByteUnits\Metric;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Domain\Files\Models\File;
|
||||
use Domain\Folders\Models\Folder;
|
||||
@@ -141,8 +142,9 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
*/
|
||||
public function getUsedCapacityAttribute(): int
|
||||
{
|
||||
return $this->filesWithTrashed
|
||||
->map(fn($item) => $item->getRawOriginal())->sum('filesize');
|
||||
return DB::table('files')
|
||||
->where('user_id', $this->id)
|
||||
->sum('filesize');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -484,12 +484,8 @@ if (! function_exists('get_storage_fill_percentage')) {
|
||||
if (! function_exists('user_storage_percentage')) {
|
||||
/**
|
||||
* Get user capacity fill by percentage
|
||||
*
|
||||
* @param $id
|
||||
* @param null $additionals
|
||||
* @return string
|
||||
*/
|
||||
function user_storage_percentage($id, $additionals = null)
|
||||
function user_storage_percentage($id, int $additionals = null)
|
||||
{
|
||||
$user = User::findOrFail($id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user