First , please note that I'm aware that I should use {!! code here !!} to parse HTML in Laravel.
But this is not the problem.
I have a textarea where people write in a description about a product they want to sell , once that saved to the database in phpmyadmin I can see that the input is of multiple lines .
However , when I do {!! $product->description !!} in my view it shows all the description in single line.
I found a workaround for it but I think there must be a better method to fix this.
the work around that I found is to do the following to replace the new lines with <br> HTML tag:
$d = $product->description;
$d = str_replace("\r\n","<br>", $d); // for Windows
$d = str_replace("\n","<br>", $d); // for Linux-like operating systems
And then I echo $d
and it works just fine , is there any better approach to solve this problem ?
I am using Laravel 5.5.