What is the difference between {{-- --}} and {{ }} in laravel framework blade files? - laravel

In the laravel framework we can use blade to add PHP code in html file.
We are using both {{-- --}} and {!! !!} syntax in blade files of Laravel framework .
What is the basic difference between them?

{{-- --}} is used to include comments, {!! !!} is used to display a variable without escaping it, for example to display html content.

{{-- --}} is to create comments in your blade files.
{!! !!} is for displaying data without escaping it.
You can read about those in the laravel docs:
https://laravel.com/docs/5.8/blade#comments
https://laravel.com/docs/5.8/blade#displaying-data

The first {{-- --}} is used for Blade comments, it will not be displayed in HTML.
The second {!! !!} is used to display unescaped data.

{{-- This comment will not be present in the rendered HTML --}}
{!! it is used for escape html while rendering !!}

Related

{!! Menu::render('admin-sidebar-menu', 'adminltecustom'); !!} Laravel, Admin LTE Sidebar Customization

{!! Menu::render('admin-sidebar-menu', 'adminltecustom'); !!}
I am editing a laravel code and want to make canges in my sidebar. but i donot understand this line, and I cannot find the source of sidebar.
Anyone who can help me out what does it actually means. and how can I edit my sidebar of the project.
The blade Syntax {!! !!}
is used to used to print HTML as it is without escaping it.
Use it cautiously as it is used to avoid escaping data, and can be result in security failures if used incorrectly.

How to show quileditor's content with blade

Normally, v-html in vue would solve this issue, I dont know how to get around it using blade. Note, if i use the mustache syntax it would show the contents with the tags and thats not okay.. Please any help is appreciated
You need to use {!! !!} instead of {{ }}
{!! $content !!}
https://laravel.com/docs/8.x/blade#displaying-unescaped-data

how to use blade Html:: class inside Html:: class in laravel 5.1

I am trying to display an image instead of word "back" to go to previous page how do i do that ?
{!! Html::linkRoute('authors', Html::image(images/back.png)) !!}
The only thing that is not okay with your code is the missin single quotes
{!! Html::linkRoute('authors', Html::image('images/back.png')) !!}
but if that does not work, you can always use an a element
Html::image('images/back.png')

Laravel submitting form as GET but coded as POST

I've just created a form with blade and for some reason its posting with GET even though the HTML says POST and to a different URL (see gif http://cl.ly/image/381k1j0t3x3c )
Routes:
http://cl.ly/image/101V1g2l2X1K
Controler:
http://cl.ly/image/1P2b0O0u3U0q
Blade File:
http://cl.ly/image/2m3B0g3g1T1S
Has anyone had this issue before, anyone see something dumb I've missed?
In your view, remove <form role='form'> tag. Don't wrap form with another form
{{ Form::open(['action'=>'CategoryController#adminStoreCategory']) }}
....
{{ Form::close() }}

Form::password in Laravel Blade Templates

I was trying to create a password field in the form in Laravel Blade templates but the output doesn't let me enter anything and it's not showing any placeholder either. The code doesn't cause any error.
Form:
{{ Form::open(array('class'=> 'forming')) }}
{{ Form::text('username','Username',array('class' => 'insi')); }}<br>
{{ Form::password('password',array('placeholder'=>'Password','class' => 'insi')); }}
{{ Form::close() }}
and the output is like that. Any help?
Second Input form is for password.
We are not seeing your generated HTML, but usually those problems are related to your HTML. For instance, you are using a CSS class 'insi', which may not letting you see the password characters.
To do a test remove/disable your CSS files from your main HTML and it probably will work fine.

Resources