【问题标题】:Redirect back Laravel 5?重定向回 Laravel 5?
【发布时间】:2015-12-18 08:48:48
【问题描述】:

我有一个表单过滤器和一个带有结果数据的网格。在表中,我单击一个字段并更新此字段,在控制器中返回 Redirect::back(),在这种情况下,表单中的所有字段都被重置,但我需要保留此值。按下的字段不在这个表单中。请问如何解决这个问题?

{!! Form::open(['url' => 'admin/filter', 'method'=>'put','class' => 'navbar-form']) !!}
//text fields for filter
{!!Form::close!!}

table
<td>
@if($mark->enabled==1)
<p>
{!! HTML::link('admin/showEnabled/'.$mark->id,'', ['class' => 'glyphicon glyphicon-eye-open']) !!}
</p>
@else
<p>
{!! HTML::link('admin/showEnabled/'.$mark->id, '',['class' => 'glyphicon glyphicon-eye-close']) !!}
</p>
    @endif
<td>
</table>
--------------
Cotroller admin showEnabled
update field
Redirect::back()

【问题讨论】:

    标签: php laravel redirect


    【解决方案1】:

    使用withInput()链接方法:

    return Redirect::back()->withInput();
    

    或者,在最新版本中:

    return back()->withInput();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-23
      • 2015-08-04
      • 2016-04-06
      • 2015-04-08
      • 2015-07-09
      • 1970-01-01
      相关资源
      最近更新 更多