dimanche 24 février 2019

How to send line breaks from Laravel controller to display multiple lines in blade page message

In my controller I have the I have a redirect if a condition is met and want to use the page message to convey the reason for the redirect. However, I can't find a way to send a line break from the controller to the bootstrap message area so that it displays multiple lines. I can find many answers for what to do in the blade, mainly escaping the HTML with {! markup !}, but that doesn't work in the controller where I'm sending the message.

Here's my controller code:

$message = "Nothing to do. </br>You must first enter account data to generate a report";
            return redirect()->route('admin.home')->with('message', $message);

The "</br>" tag is displayed. I've tried "/n" and "&#10;" to no avail, they don't render but also no line break. I need to send more detailed messages depending on the condition for redirecting which won't work if everything has to go on one message line.

I'm using Laravel 5.5 in XAMPP (PHP 7) on Windows 10, Chrome for dev browser, VS Code for coding.

Any suggestions?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire