storage_limit_in_mb == 0) { return true; } // get the file size of all the files in the account // the size will be in bytes $vaultIds = $account->vaults()->select('id')->get()->toArray(); $totalSizeInBytes = File::whereIn('vault_id', $vaultIds)->sum('size'); $accountLimit = $account->storage_limit_in_mb * 1024 * 1024; return $totalSizeInBytes < $accountLimit; } /** * Get the Uploadcare data needed for the views. */ public static function uploadcare(): array { $signature = config('services.uploadcare.private_key') != '' ? new Signature(config('services.uploadcare.private_key')) : null; return [ 'publicKey' => config('services.uploadcare.public_key'), 'signature' => optional($signature)->getSignature(), 'expire' => optional(optional($signature)->getExpire())->getTimestamp(), ]; } }