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

s_denni's avatar

double curly brackets inside double curly brackets.

<a class="btn btn-warning" href="{{ url('barang/{{$barang->id_brg}}/edit') }}"><i class="icon_pencil-edit"></i></a>

those code I want to generate like this

<a class="btn btn-warning" href="localhost/laravel/public/barang/$id/edit')"><i class="icon_pencil-edit"></i></a>

error message was like below

Parse error: syntax error, unexpected '}', expecting ',' or ')'

Maybe because I input double curly brakets inside double curly brackets. who give me thoose error.

my question

is there another way to generate those link ? without manually type the url.

Thanks.

0 likes
3 replies
Snapey's avatar
Snapey
Best Answer
Level 122

You don't need blade tags inside a blade tag, you can use regular PHP for string concatenation, or if inside double quotes you can insert variable directly into string.

Concatenation

href="{{ url('barang/' . $barang->id_brg . '/edit') }}"

Inject directly into string (can't remember the right term)

href="{{ url("barang/{$barang->id_brg}/edit") }}"

edit: http://php.net/manual/en/language.types.string.php#language.types.string.parsing

s_denni's avatar

@Snapey

is blade tag is equals to php tag ?

so everything when I use blade tag ( {{ .. .. .. }} ) inside of them is php ?

how about @if @section @yield on blade.

I have a little information about blade templating.

Snapey's avatar

Double curly braces are equivalent to an echo() type function but with filtering.

1 like

Please or to participate in this conversation.