Laravel 5.5使用锚和数据重定向到url

Laravel 5.5使用锚和数据重定向到url,laravel,laravel-5,laravel-5.5,laravel-form,Laravel,Laravel 5,Laravel 5.5,Laravel Form,在我的footer.blade.php中,我有以下关于订阅的代码 <!--Subscription--> @if(Session::has('success')) <div class="form-group has-success"> <input class="form-control form-control-success" type="text" id="input-s

在我的footer.blade.php中,我有以下关于订阅的代码

        <!--Subscription-->
        @if(Session::has('success'))
            <div class="form-group has-success">
                <input class="form-control form-control-success" type="text" id="input-success">
                <div class="form-control-feedback">{{ Session::get('success') }}</div>
            </div>
        @elseif(Session::has('failed'))
            <div class="form-group has-danger">
                <input class="form-control form-control-danger" type="text" id="input-danger">
                <div class="form-control-feedback">{{ Session::get('failed') }}</div>
            </div>
        @else
            {!! Form::open(['route'=>'subscribe.store', 'class' => 'subscribe-form', 'novalidate' => 'novalidate']) !!}
            <div class="clearfix">
                <div class="input-group input-light">
                    {!! Form::email('email', old('email'), ['class'=>'form-control ', 'placeholder'=>'Your e-mail']) !!}
                    <span class="input-group-addon"><i class="icon-mail"></i></span>
                </div>
                <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
                <div style="position: absolute; left: -5000px;" aria-hidden="true">
                    <input type="text" name="b_c7103e2c981361a6639545bd5_1194bb7544" tabindex="-1">
                </div>
                <button class="btn btn-primary" type="submit">
                    <i class="icon-check"></i>
                </button>
            </div>
            {!! Form::close() !!}
            <span class="form-text text-sm text-white opacity-50">Subscribe to our Newsletter to receive early discount offers, latest news, sales and promo information.</span>
        @endif
虽然一切都很好,但我还是希望页面向下滚动到页脚,因为现在它会重新加载并保持在顶部

我找到了
return redirect()->to(app('url')->previous()。#hashid')

但是无法在页脚的
id
之间传递数据

我也试过了

return redirect()->back()->带有('failed','您已在我们的新闻稿系统中注册。')。'#网站页脚';
它没有向下滚动


有什么想法或解决方法吗?

我刚刚测试了这段代码。它将重定向您,向下滚动到定位点并传递数据:

session()->flash('someVariable', $someData);
return redirect(url()->previous() . '#hashid');
要获取存储的数据,请执行以下操作:

$someData = session('someVariable');
或者从某种角度来看:

{{ session('someVariable') }}

它的固体,它的工作。刷新后,带有“someVariable”的会话已被删除,因此我接受此答案。谢谢你,伙计!很高兴这有帮助。)
{{ session('someVariable') }}