Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Output raw HTML from Laravel

I have a form containing a textarea that stores user input in a table.

Currently when I pull this data in my view, {{ $data->textarea }} it outputs <strong> as &lt;strong&gt;. I'd like to either use or build a very basic WYSIWYG editor, but I don't think it will work if I can't output the raw HTML.

Is there some sort of attribute I need to define in my view or controller?


Meta: Would it be wiser to create a system like the Stack Exchange or Reddit where **this is bold text**?

like image 251
O P Avatar asked May 05 '15 15:05

O P


1 Answers

I'm assumng you're using the latest version of Laravel 5 because it escapes everything by default. If so then you need to use one brace and two exclamation marks to tell Blade not to escape it. This should do what you need:

{!! $data->textarea !!}
like image 96
Styphon Avatar answered Oct 16 '22 04:10

Styphon