DEV Community

Techsolutionstuff
Techsolutionstuff

Posted on • Originally published at techsolutionstuff.com

Line Breaks in Laravel Blade

Today we will see how to break line for textarea in laravel blade.When you want to display or print data from database at that time you can get result same as store in database like single line and you didn't get proper output. So,that time we are using php function nl2br() in blade file.

Laravel helper provide many functionalities and you can use e Laravel helper function to purify your html before showing line breaks.

You need to do the escaping first using e() and then after apply nl2br() function.

{{ nl2br(e($data)) }}

// OR

{!! nl2br(e($data)) !!}
Enter fullscreen mode Exit fullscreen mode

Discussion (0)