user()->account->id) ->orderBy('created_at', 'desc') ->get(); $photos = Photo::where('account_id', auth()->user()->account->id) ->orderBy('created_at', 'desc') ->get(); // size is in bytes in the database $currentAccountSize = StorageHelper::getAccountStorageSize(auth()->user()->account); if ($currentAccountSize != 0) { $currentAccountSize = round($currentAccountSize / 1000000); } // correspondingPercent $percentUsage = round($currentAccountSize * 100 / config('monica.max_storage_size')); $accountHasLimitations = AccountHelper::hasLimitations(auth()->user()->account); return view('settings.storage.index') ->withAccountHasLimitations($accountHasLimitations) ->withDocuments($documents) ->withPhotos($photos) ->withCurrentAccountSize($currentAccountSize) ->withAccountLimit(config('monica.max_storage_size')) ->withPercentUsage($percentUsage); } }