Skip to content
Advertisement

Blade – Print variable into variable

I am trying to print a variable into another variable in a blade template. I have a variable from database that contains “dynamic” data from another variable.

Example:

JavaScript

In blade I am doing this:

JavaScript

But the result is:

JavaScript

I tried with {{}} but the result is the same.

I can’t concatenate both variables. For example:

JavaScript

It isn’t possible because I don’t have the control of the variables, they are filled dynamically from database.

Any idea/suggestion?

Thanks

Advertisement

Answer

Use eval function if the input is not direct from user,and remove {{...}} double curly bracket. you can used below code in .blade.php file

JavaScript

You will get output as

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement