Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Laravel 雄辩的更新不会';我不在拉威尔6号工作_Laravel_Eloquent - Fatal编程技术网

Laravel 雄辩的更新不会';我不在拉威尔6号工作

Laravel 雄辩的更新不会';我不在拉威尔6号工作,laravel,eloquent,Laravel,Eloquent,在以以下形式提交后,我正在尝试更新字段: <form action="{{ route("comments.update") }}" method="post"> @csrf <input type="hidden" name="commentIDToEdit" id="commentID"> <div class="md-form mb-5">

在以以下形式提交后,我正在尝试更新字段:

   <form action="{{ route("comments.update") }}" method="post">

                @csrf

                <input type="hidden" name="commentIDToEdit" id="commentID">
                <div class="md-form mb-5">
                    <i class="fas fa-comment"></i>
                    <label for="toEditComment"></label>
                    <textarea name="toEditCommentary" id="toEditComment" cols="3" rows="5" style="resize: none"
                              class="form-control"></textarea>
                </div>
                <div class="modal-footer d-flex justify-content-center">
                    <button type="submit" class="btn btn-default">Modificar</button>
                </div>
            </form>
奇怪的是,他的表中更新了注释,但没有更新警告。我在考虑模型中的fillable属性,但我没有它,相反,我有以下代码:

protected $guarded = [];
const UPDATED_AT = null;
const CREATED_AT = null;

隐藏的输入名为
commentIDToEdit
,但在控制器中,使用
请求(“commentIDToEdit”)
(不同的情况)获取警告

你写的内容:

Caveat::where("commentID", request("commentIDtoEdit"))
您应该执行的操作:(注意不同的大小写)


这是因为在视图中,输入的
name
commentIDToEdit
,而不是
commentIDToEdit

有什么问题?@A.ANoman该字段不更新此post方法。那么你的
$request->all()
注释在他的表中更新了,但没有警告,那是什么?@ChristopherHubert抱歉。该警告引用了警告表。我试图将名为commentID的警告列与请求(“commentIDtoEdit”)进行比较。这样不对吗?我进一步扩展了我的解释
Caveat::where("commentID", request("commentIDtoEdit"))
Caveat::where("commentID", request("commentIDToEdit"))