@php $txt = $btn->texto_inserir ?? ''; $opcoes = []; if (is_string($txt) && $txt !== '' && isset($txt[0]) && $txt[0] === '[') { $dec = json_decode($txt); if (is_array($dec)) { $opcoes = $dec; } elseif (json_last_error() !== JSON_ERROR_NONE) { Log::channel('warning-proposta')->warning('warning-proposta', [ 'action' => 'botoes_descricao_json_invalido', 'id' => $btn->id ?? null, 'id_transportadora' => $btn->id_transportadora ?? null, 'error' => json_last_error_msg(), ]); } } $textos = (is_array($opcoes) && count($opcoes) > 1) ? array_values(array_filter($opcoes, function ($t) { return $t !== '' && $t !== null; })) : []; $dataTextosInserir = count($textos) > 1; $dataTextoInserirVal = $dataTextosInserir ? '' : e(is_array($opcoes) && count($opcoes) === 1 ? (string)($opcoes[0] ?? $txt) : $txt); @endphp