Home > Net >  Format html text from database to Laravel with blade
Format html text from database to Laravel with blade

Time:04-21

In the database a field is saved with html text formatted as for example this:

<p>Esto es un <strong>mensaje </strong>de prueba</p>

When I show it on the screen in blade, the tags appear and it does not format it.

Does anyone know how to make it format?

I have tried this

<p>{{$notification->message}}</p>

{{$notification->message}}

Shows:

<p>Esto es un <strong>mensaje </strong>de prueba</p>

but I would like this:

Esto es un mensaje de prueba

CodePudding user response:

To show unescaped data, use {!! $$notification->message !!}

Refer to https://laravel.com/docs/9.x/blade#displaying-unescaped-data

  • Related