Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

elqouent10's avatar

Blade Escaping

I know you can escape the blade syntax {{ }} with a @ in front. @{{ }}

What happens when you need to escape a parent set of curly brackets, but you need Blade to interpret the php inside the child bracket?

For example:

//Using Angular
@foreach ($chairs as $chair) 
<img ng-src="@{{getUrl({{$chair->id}})}}">
@endforeach

I need Blade to interpret $chair->id to get an integer, which Angular will then use to get a URL.

0 likes
2 replies
Snapey's avatar

I don't know the answer, and I'm assuming what you have does not work, but you could fall back to php tags?

<img ng-src="@{{getUrl(<?php echo $chair->id; ?>)}}">
SaeedPrez's avatar

Try this..

{{ urldecode('&#123;&#123;') . getUrl($chair->id) . urldecode('&#125;&#125;') }}

Please or to participate in this conversation.