1
votes
    // session()->flash("message", "{{ setting('site.contact_success_msg') }}"); //doesn't work
    // session()->flash('message', 'Thank you so much for your feedback.'); //works.
    session()->flash('message', {!! setting('site.contact_success_msg') !!});//doesn't work

I am trying to show a flash message to the user. I have set the message from Voyager, using Rich text editor to output something like:

Success! Thank you so much for your feedback.

But the above code shows this error message:

Symfony\Component\Debug\Exception\FatalThrowableError thrown with message "Parse error: syntax error, unexpected '{'"

Stacktrace:

0 Symfony\Component\Debug\Exception\FatalThrowableError in C:\xampp\htdocs\blog\app\Http\Controllers\FeedbackController.php:85

Could anyone please help?

Thanks in advance!

1

1 Answers

2
votes

Ok, I've got it. I used the following code:

session()->flash('message', setting('site.contact_success_msg'));

And then where I flashed the message, I used:

$flash = session('message')

and then showed the output message where I needed using:

{!! $flash !!}

instead of:

{{ $flash }}