sergionader's avatar

How to apply HTML tags inside a bootstrap alert box?

Hi!

It seems very basic, but I couldn't find a solution.

  1. I have a controller that will call a blade: return redirect()->route('app.vendor.search', [$variables])->with('info-success', 'File uploaded successfully.');
  2. the blade has the following code:
                <div class="alert alert-success alert-dismissible">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                    <h4>
                        <i class="icon fa fa-check"></i> Success!</h4>
                        {{ Session::get('info-success') }}
                </div>
  1. It works very well.
  2. However, if I try something like return redirect()->route('app.vendor.search', [$variables])->with('info-success', 'File <strong>uploaded</strong> successfully.'); the "strong" tag will be ignored. As matter of fact all the tags I've tried were ignored.

Any ideas?

Thanks !!

0 likes
4 replies
lostdreamer_nl's avatar
Level 53

Changing this might work:

{{ Session::get('info-success') }}

becomes

{!! Session::get('info-success') !!}

{{ $variable }} will encode everything into HTML entities, {!! $variable !!} will not

2 likes
Cronix's avatar

@sergionader I'm glad you've got it working. Please mark the post as solved by clicking on the checkbox under the persons avatar next to the post that helped you. It will help others searching to find the solution.

Please or to participate in this conversation.