Reputation: 915
I'm trying to show an HTML containing variables if a condition was met, else just show "test" word.
<a href="/StuffSpot/notifPost/{{ $notification->id }}">{{ $notification->read == 1 ? '<strong>{{$notification->send_uname}}</strong> has commented on <strong>{{$notification->title}}</strong> post' : 'test' }}</a>
I'm receiving the following error :
Parse error: syntax error, unexpected '}', expecting ',' or ')'
Upvotes: 0
Views: 193
Reputation: 2971
<a href="/StuffSpot/notifPost/{{ $notification->id }}">
@if($notification->read == 1)
<strong> {{ $notification->send_uname }}</strong> has commented on <strong>{{ $notification->title }}</strong> post
@else
test
@endif
</a>
Try if
else
instead of one line Ternary Logic.
Also you have already used {{ }}
to echo out, dont use {{ }}
inside another, to display the html tags use {!! !!}
, laravel blade {{ }}
will escape and echo out the html tags inside these field
Upvotes: 1