I'm new to Laravel and I faced this issue, when I'm using @yield('content') to view some HTML, the out put will be the exact contact with decoding it into HTML.
Here is my code :
@yield('content',"<p>This is a great starting point for new custom pages</p>")
And the out put is : <p>This is a great starting point for new custom pages</p>
And here is a screenshot :

Can someone help me know what's going on please?
In Laravel, the @yield directive is looking to pull the @section that you note up from whichever file is producing the html. When you pull in the @section, it is formatted as proper html on the page.
So, if you had a section like this:
@section('paragraph')
<p>here is some text</p>
@stop
And pulled this in a @yield statement:
@yield('paragraph')
This would simply output the html:
here is some text
What you have done with this:
@yield('content',"<p>This is a great starting point for new custom pages</p>")
is to supply default text to display on the screen if the 'content' section is unavailable. This text is escaped, thus you are seeing the html tags.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With