Quantcast
Channel: Laravel 4 how to display flash message in view? - Stack Overflow
Viewing all articles
Browse latest Browse all 12

Answer by brainless for Laravel 4 how to display flash message in view?

$
0
0
{{ Session::get('success') }}

This just echos the session variable 'success'. So when you use

{{ Session::get('success') }} @if($success) <div class="alert-box success"> <h2>{{ $success }}</h2> </div> @endif

you are seeing it's output along with the error of the next statement. Because with() function only sets the value in Session and will not set as a variable. Hence @if($success) will result in undefined variable error.

As @Andreyco said,

@if(Session::has('success'))
<div class="alert-box success">
    <h2>{{ Session::get('success') }}</h2>
</div>
@endif

This should work.

The reason you are not seeing it might be because the action you are performing is not success. And this does not require you to either reinstall xampp or modify php.ini.


Viewing all articles
Browse latest Browse all 12

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>