/** * Create a new redirect response, while putting the current URL in the session. * * @param string $path * @param int $status * @param array $headers * @param bool $secure * @return \Illuminate\Http\RedirectResponse */ public static function guest($path, $status = 302, $headers = array(), $secure = null) { $url = str_replace('ajax=1', '', parent::getUrlGenerator()->full()); Session::put('url.intended', $url); return parent::to($path, $status, $headers, $secure); }