Jonio
Jonio

Reputation: 1293

laravel 5.6 insert an href into message redirect

I have a problem to insert a redirect link into a message in a redirect laravel command. This is what I woould to have:

return redirect('validation')->with('warning','to correct mistake, click here');

and after click on the here, I have to load another page with the url mapped on here. Something like this, but this solution not work:

return redirect('validation')->with('warning','to correct mistake, click <a href="#top">here</a>');

Upvotes: 0

Views: 115

Answers (1)

Mosi
Mosi

Reputation: 198

I think you using the this in you view to show the warning.

{{ session('warning') }}

You need to use these brackets in your view to show the warning and to allow the html to be processed by the browser.

{!! session('warning') !!}

These brackets {{ }} escape html tags and will render html as plain text to prevent XSS attacks.

If you want to inject html from the backend you must use {!! $html !!} which will render the html as html.

You can checkout the Displaying Date -- Laravel Docs for a better explanation.

Upvotes: 3

Related Questions