Blade: escaping text and allowing new lines Blade: escaping text and allowing new lines laravel laravel

Blade: escaping text and allowing new lines


You can do the escaping first, using e() and then apply nl2br():

{{ nl2br(e($text)) }}

e() is the function Blade uses when compiling triple brackets


You can use this

{!! nl2br(e($text)) !!}


in simple approach you can use it in blade File

{!! nl2br(e($onlineSetting->instruction)) !!}