Laravel @verbatim Directive

The {{}} print syntax we use in Blade is also used in most popular Javascript frameworks. Let's take Vue as an example.

In Blade, we need to use it as @{{ }} so that it doesn't interpret this syntax. Although it is not a problem to put the @ sign in sporadic spellings, it can be tedious to put the @ sign in front of all of them when we want to display many different data in vue or similar frameworks.

<div id="app">
    Name @{{ name}}
    Surname @{{ surname }}
    Age @{{ age}}
    <!-- And imagine there are a few more -->
</div>

To make this easier to write, Laravel offers us the @verbatim directive. When we write these codes in this directive, we no longer need to use the @ sign because it does not interpret the {{}} code in this directive as a blade syntax.

<div id="app">
@verbatim
    Name {{ name }}
    Surname {{ surname }}
    Age {{ age }}
    <!-- And imagine there are a few more -->
@endverbatim
</div>

Is it used? It is debatable, it would be good for you to know that there is such a directive if it bothers you one day.

Comments

There are no comments, make the firs comment