【发布时间】:2019-02-20 05:00:56
【问题描述】:
你好,我有编辑表单,它有 3 个输入,两个是文本,一个是文件输入,所以它的编辑表单所以我必须输入输入的值,所以当人提交时它只会保存他的更改
问题是,每次您输入此编辑表单时,它都需要您上传图片,并且我希望文件输入从数据库中获取其值,就像两个文本输入一样,我该怎么做?
{!! Form::model($work,['method' => 'PATCH','enctype' =>
'multipart/form-data' ,'files' => true ,'action'=>
['worksgallarey@update_work','id'=>$work->id,]]) !!}
<div class="form-group{{ $errors->has('title') ? ' has-error' :
''}}">
{{Form::label('title', 'Title')}}
{{Form::text('title', $work->title, ['class' => 'form-control
required' , 'placeholder' => 'Enter a title'])}}
</div>
<div class="form-group{{ $errors->has('picture') ? ' has-error' :
''}}">
{!! Form::label('picture') !!}
{!! Form::file('picture')!!}
</div>
<div class="form-group{{ $errors->has('bio') ? ' has-error' : ''}}">
{{Form::label('bio', 'Bio')}}
{{Form::text('bio', $work->bio, ['class' => 'form-control
required', 'placeholder' => 'Write a bio '])}}
</div>
{{Form::submit('submit',['class' => 'btn btn-primary'])}}
这是我的代码,我试过了
<div class="form-group{{ $errors->has('picture') ? ' has-error' :
''}}">
{!! Form::label('picture') !!}
{!! Form::file('picture' , $work->picture )!!}
</div>
但是没用
【问题讨论】: