{{-- LOGO --}} {{-- CODIGO BANCO --}} @php $bcode = $bank->bank_code ?? '237'; $bankTypeHdr = strtoupper($bank?->integration_type ?? ''); // Calcula DV do código do banco: (soma * 10) % 11 (padrão FEBRABAN) if ($bankTypeHdr === 'BRADESCO' && strlen($bcode) === 3) { $s = 0; $w = 2; for ($i = strlen($bcode) - 1; $i >= 0; $i--) { $s += intval($bcode[$i]) * $w; $w = ($w >= 9) ? 2 : $w + 1; } $bDv = ($s * 10) % 11; $bDv = ($bDv === 10) ? 0 : $bDv; } else { $bDv = 'X'; } @endphp {{-- LINHA DIGITAVEL --}}
@php $logoFullPath = $logoPath ? public_path($logoPath) : ''; @endphp @if($logoFullPath && file_exists($logoFullPath) && is_file($logoFullPath)) Banco @else {{ strtoupper($bank?->integration_type ?? 'BANCO') }} @endif
{{ $bcode }}-{{ $bDv }}
@php $ld = $boleto->linha_digitavel ?? '00000000000000000000000000000000000000000000000'; // remove qualquer caractere que não seja número $ld = preg_replace('/\D/', '', $ld); if (strlen($ld) == 47) { $ld = substr($ld, 0, 5) . '.' . substr($ld, 5, 5) . ' ' . substr($ld, 10, 5) . '.' . substr($ld, 15, 6) . ' ' . substr($ld, 21, 5) . '.' . substr($ld, 26, 6) . ' ' . substr($ld, 32, 1) . ' ' . substr($ld, 33, 14); } @endphp {{ $ld }}