I'm working on a Laravel App and I am displaying a content from the database, the datatype is text
and this is the content
<span style="font-weight: bold; font-style: italic;">What is your dog's name?</span>
As you can see it has HTML tags but when I rendered it in my view, instead of formatting the text What is your dog's name?
It is displaying the entire content
<span style="font-weight: bold; font-style: italic;">What is your dog's name?</span>
It's not reading the HTML tag. Is there a convertion that I need to do in the formatting? When I view source it,
<span style="font-weight: bold; font-style: italic;">What is your dog's name?</span>
Here's my code:
View
<table class="table table-striped table-bordered">
<tbody>
@foreach($questions as $key => $value)
<tr>
<td class="">{{ $value->Question }}</td>
</tr>
@endforeach
</tbody>
My controller:
public function create()
{
$questions = Question::where('IsEnabled', '=', 'Yes')->get();
return view('crm.create')->with(array('questions' => $questions));
}
You need to tell blade not to escape HTML by using this
{!! !!}
NB: This is applicable if you are using Laravel 5