Line Breaks For Textarea Text in Laravel Blade

  12716 views   2 years ago Laravel

Hi, in this article i will show you how to Line Breaks For Textarea Text in Laravel Blade. this is very common problem face in laravel application.

if you write some text in textarea and then save in database and when you display same text then it's look like dispay in one line, so how to resolve this issue in laravel blade?

simple use this solution.


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

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

// OR

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

i hope you like this small solution.

Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]