【问题标题】:Laravel Form model binding for image not working图像的 Laravel Form 模型绑定不起作用
【发布时间】:2017-11-03 19:40:06
【问题描述】:

在我的编辑表单模型绑定中,我想显示车辆图像,我的视图刀片中有代码:

{!! Form::model($cedit, ['method' => 'PATCH','route' => ['category.update', $cedit->id], 'files' => true]) !!}
    <div class="form-group">
       <img src="images/{{ $cedit->name }}"/>
    </div>

    <button type="submit" class="btn btn-primary">Submit</button>
    </div>
{{ Form::close() }}

我怎样才能实现它?

【问题讨论】:

    标签: php laravel-5


    【解决方案1】:

    为了访问资源,您应该使用 asset() 帮助程序来获取公共目录的完整路径,如下所示:

    <div class="form-group">
        <img src="{{asset('/images/'.$cedit->name)}}">
    </div>
    

    【讨论】:

    • 这有什么帮助?包括对你所做的事情的描述,以及它为什么有帮助,将提高你回答的质量。
    猜你喜欢
    • 2017-06-27
    • 1970-01-01
    • 2016-06-14
    • 1970-01-01
    • 2018-05-26
    • 2013-07-13
    • 2012-05-31
    • 2013-09-26
    • 2015-07-30
    相关资源
    最近更新 更多