简体   繁体   English

无法以编辑形式显示数据:laravel

[英]failing to display the data in the edit form : laravel

when I using model like this : 当我使用这样的模型时:

<div class="form-group col-sm-6">
        {!! Form::label('nop3', 'Nop3:') !!}
        {!! Form::text('nop3', null, ['class' => 'form-control']) !!}
    </div>

data nop3 can be displayed in textfield nop3 : https://postimg.org/image/x4ar40u7b/ 数据nop3可以显示在文本字段nop3中: https ://postimg.org/image/x4ar40u7b/

but, I using model like this : 但是,我使用这样的模型:

<div class="form-group col-sm-6">
    <div class="form-group col-sm-3">
        NOMOR P3
    </div>
    <div class="form-group col-sm-9">
        <input type="text" name="nop3" class="form-control">
    </div>
</div>

data nop3 can not be displayed in textfield nop3 : https://postimg.org/image/jin2ns0y9/ 数据nop3无法显示在文本字段nop3中: https ://postimg.org/image/jin2ns0y9/

whereas these two models the same 而这两个模型相同

if anyone can explain to me? 如果有人可以向我解释?

Your assumption, that the two approaches you showed in your question are the same, is wrong! 您认为问题中显示的两种方法相同的假设是错误的!

When using the Form helper class, there are a lot things that work behind the scenes. 使用Form helper类时,幕后有很多事情要做。

If you decide not to use the helper classes, you need to populate your form manually! 如果决定不使用帮助器类,则需要手动填充表单!

It can look like this: 它看起来可能像这样:

<div class="form-group col-sm-6">
    <div class="form-group col-sm-3">
        NOMOR P3
    </div>
    <div class="form-group col-sm-9">
        <input type="text" name="nop3" class="form-control" value="{{$nop3}}">
    </div>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM