Search code examples
phpjquerylaravelnotifyjs

Laravel session Convert tags to html entity


I want to convert this message value to an html entity :

return redirect('/')->withErrors(['success' => 'register done .<br> Thanks for register.']);

but in my blade :

@if($errors->first('success'))
       $('.top-right').notify({
        message: { html: " <b>{{ $errors->first('success') }}</b> " },
        type: 'success',
        fadeOut: { enabled: true, delay: 7000 }
    }).show();
@endif

{{ $errors->first('success') }} show this:

register done .<br> Thanks for register

Solution

  • you should use :

    {!! $errors->first('success') !!}
    

    instead of

    {{ $errors->first('success') }}