The back() helper generates a redirect response to the previous URL, providing an easy way to navigate users back with optional parameters for status, headers, and fallback.
// Redirects with a 302 status by default
return back();
// Redirects with a custom status, headers, and a fallback URL if the previous location is not available
return back(301, ['X-Custom-Header' => 'value'], '/fallback');
|