FareedR
2 months ago

How can I ignore " + " in blade for the last index of array ?

Posted 2 months ago by FareedR
// 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

Please sign in or create an account to participate in this conversation.