It is a doubt that I have tried to solve on my own using different methods, but none has given me the expected result.
The problem comes when I save a variable of type text in the database of my project. It saves it with line breaks, in fact when I try to edit it from one of my views, it respects those jumps. The problem comes when I want to show it in a blade.php
view, where all the text is without any line break.
I have used different functions such as nl2br ()
or str_replace
, and all they do is change the / n to the br tag for line breaks, and instead of applying those line breaks, write them on the screen next to the text.
I do not know if this change or modification to the variable should perhaps be executed on the server and sent to the view, instead of executing in the view {{nl2br ($ user-> proffile)}}
or with str_replace
.
First forgiveness for English and thanks in advance for the help
nl2br(e($user->proffile))
to escape user input. Works with all Laravel 8, too. – Labefaction