当我重定向到页面时,它无法填充输入字段。
if ($validator->fails()){
return Redirect::to('books/create')->with('message_warning','<strong>Warning!</strong> some input is not valid.')->withErrors($validator)->withInput();
}else{
$book->save();
return Redirect::action('BooksController@index')->with('message_success','<strong>Awesome!</strong>Your book has been successfully added.');
}
Input::old()
适用于重定向。
表格摘录
{{ Form::open(array('action' => 'BooksController@store', 'method' => 'post', 'role'=> 'form')) }}
<div class="form-group">
<label for="title">Title</label>
<input type="text" name="title" class="form-control" id="title" placeholder="Name of awesome book?">
</div>
答案 0 :(得分:0)
您必须使用旧输入指定值。
<input type="text" name="title" value="{{ Input::old('title') }}">