1
votes

Good day to all guys, I am new to Laravel and wanted to understand if there are any contrasts between Session::flash and with() (or they are totally the same) when you want to show success message to user.

1

1 Answers

4
votes

Per the docs:

Redirecting to a new URL and flashing data to the session are usually done at the same time. Typically, this is done after successfully performing an action when you flash a success message to the session. For convenience, you may create a RedirectResponse instance and flash data to the session in a single, fluent method chain.

It's just syntax sugar to make it prettier.