I am currently developing a recipe website with Laravel and I have run into an issue on my recipe show page (show individual recipe). The recipe show page displays the description, ingredients, and step-by-step instructions. Both my ingredients and step-by-step instructions are inserted into my DB as one string. The input form requests users to list each ingredient/step on an individual line. I then use the PHP function nl2br() to show the information as a list. However, I would very much like to have control of each new line, preferably be able to wrap an li around each line which I can later style in CSS.
I found this link here on Stackoverflow: wrap new line variable with
I believe this is what I'm looking for, however, I'm not sure how I would adjust this to Laravel. Currently I am using this line of code to retrieve the ingredients and step-by-step:
{!! nl2br(e($recipe->directions)) !!}
{!! nl2br(e($recipe->ingredients)) !!}
Any help on this would be very much appreciated as it is a little bit outside my current area of expertise! Let me know if I need to clarify this question a little more or provide you guys with some more context! Thank you so much! :)
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)