Line Breaks In Laravel Blade

WebSolutionStuff | Jul-26-2020 | Categories : Laravel

In this post i will show you how to break line for textarea in laravel blade.

Many times when you save some text in textarea and save into database, but when you want to display or print same data that time it is showing in same single line and you didn't get proper output. So at 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.

Use this function as below.

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

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

// OR

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

 

Featured Post




Follow us
facebooklogo github instagram twitter