Laravel 5: Misc Helper Methods: back

Helper Method: back

I prefer to tinker with code directly – I will use a couple of Laravel files directly to apply example code.

Model located at:

Controller located at:

Standard Laravel definition:
The back() function generates a redirect response to the user’s previous location.

It is extremely useful, when you deal with forms.

Say, you send a form request to server, do all the magic and then you can use back() to tell system, where to get back – e.g. in case of errors.

Consider something like this:

You tell system to:

  • redirect
  • back to where you came from
  • and pass ’email’ error

I will write more about back() , e.g. when I look in depth at form handling and some other stuff.

I would try to put links here anytime I finish something related – that is, if I do not forget.

Or you can always search.