PolloZen
PolloZen

If I use Session::flash

Session::flash('message','It´s a girl');
Redirect::to('outside');

// is almost the same use "with" parameter in a redirect.

return Redirect::to('outside')->with('messsage', 'It´s a girl');

The first question is: How Can I use this session flash data directly in a simple way in the front end?

Because I found Flash::info method

Flash::info('it´s a girl');
return Redirec::to('outside);

and, it's preatty easy use it in the template:

{% flash %}
    <p>{{ message }}</p>
{% endflash %}

Second question: In wich cases is better one instead another?

BennoThommo
BennoThommo

@PolloZen it's better to use the Flash class in most cases. Session::flash() is kept for backwards compatibility, but Flash is more featured.

1-2 of 2