Level 56
Try this:
{!! str_replace('+', '<br /> + <br />', $stock->signal->signal) !!}
The {!! ... !!} won't escape the output
Also you might not even need to handle the special case of one item in the list
// database
id | signal |
1 PLT+PLG
// blade
@php
$signals = explode('+', $stock->signal->signal);
@endphp
@if(count($signals) > 1)
@foreach($signals as $signal)
{{ $signal }} <br/> + <br/>
@endforeach
@else
{{ $signals[0] }}
@endif
// current result
PLT
+
PLG
+
// expected result
PLT
+
PLG
Try this:
{!! str_replace('+', '<br /> + <br />', $stock->signal->signal) !!}
The {!! ... !!} won't escape the output
Also you might not even need to handle the special case of one item in the list
Please or to participate in this conversation.