Decoding HTML tags in Laravel 5

I am using CKeditor for my Laravel 5.1 custom CMS. When I request content of stored pages in the database on my view, they appear with HTML tags like <p>Hello world</p>. I have used html_entity_decode() with and without the charset specified to no avail. It is also worth mentioning that I use Blade template engine at my view. Hence, my demo code looks like

$post->content = '<p>Hello world</p>'; // from the database from controller
{{html_entity_decode($post->content)}} //did not decode

I also tried using it in my controller instead and it did not change anything like this

$post->content = html_entity_decode($post->content); //before sending it to the view

I need your help to address this issue.

SOLUTION

Instead of doing {{html_entity_decode($post->content)}}, try this instead:

{!! $post->content !!}

Leave a comment