chore: refactor account model (#3570)

This commit is contained in:
Regis Freyd
2020-02-13 10:48:51 -05:00
committed by GitHub
parent 2e8a597c27
commit 5bf26262dc
45 changed files with 837 additions and 696 deletions
@@ -3,6 +3,8 @@
namespace App\Http\Controllers\Settings;
use App\Models\Account\Photo;
use App\Helpers\AccountHelper;
use App\Helpers\StorageHelper;
use App\Models\Contact\Document;
use App\Http\Controllers\Controller;
@@ -22,7 +24,7 @@ class StorageController extends Controller
->get();
// size is in bytes in the database
$currentAccountSize = auth()->user()->account->getStorageSize();
$currentAccountSize = StorageHelper::getAccountStorageSize(auth()->user()->account);
if ($currentAccountSize != 0) {
$currentAccountSize = round($currentAccountSize / 1000000);
@@ -31,7 +33,10 @@ class StorageController extends Controller
// 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)