Comment in .blade.php template

Viewed 5373

I am new in blade template. How i comment here?

PHP i can comment like this

<?php // echo $games;?>

Laravel Blade

{{ $game }}

2 Answers

In blade syntax, a comment starts with {{-- and ends with --}}

{{-- this is a comment --}}

But to comment out multiple lines, use standard PHP block comments instead, like:

<?php /* 
@if ($condition)
    {{ HTML::form("foo") }};
@endif
*/ ?> 

And never nest Blade and/or PHP code inside of Blade comments.

See also stackoverflow.com/Why Blade comment causes page to crash?

In laravel 8 you should use this syntax for comment

 {{--  --}} or <!-- -->
Related