Laravel back button

In Laravel, you can use the back function to redirect the user to their previous page. This is equivalent to calling the redirect function with no parameters.

Example:

return back();

Watch a course Learn object oriented PHP

You can also pass a fallback URL as a parameter to the back function, which will be used if the user was not referred from another page.

Example:

return back('home');

This will redirect the user to the home page if they were not referred from another page.