This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

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?

JenniferLopez
JenniferLopez

@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

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.