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)) !!}



You might also like :


Techsolutionstuff | The Complete Guide

I'm a software engineer and the founder of Hailing from India, I craft articles, tutorials, tricks, and tips to aid developers. Explore Laravel, PHP, MySQL, jQuery, Bootstrap, Node.js, Vue.js, and AngularJS in our tech stack.