英文:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'created_by' and 'updated_by' cannot be null
问题
我一直在尝试解决这个问题,从昨天开始。在我的更新方法中有一个问题,我无法解决它。
我一直在尝试更新services
表的外键。
用户创建了一个服务,现在我想更改创建它和更新它的用户的名称,但什么都没有发生,我一次又一次地遇到这个问题。
这是我的edit.blade.php
表单字段:
这是我的控制器的更新方法:
我尝试了许多方法,搜索了成千上万的内容,几乎看了10次,但仍然没有发生任何事情。
英文:
I have been trying to solve this issue from yesterday. There is an issue in my update method and I can't figure it out.
I have been trying to update my foreign key of the services
table.
User created a service and now I want to change the name of the user that created it and that updated it but nothing is happening I am getting this issue again and again.
This is my form field of the edit.blade.php
And this is the update method of my Controller:
I have tried many things, searched for thousand of things , watched for almost 10 times still nothing happened.
答案1
得分: 0
- 检查选项的值,确保它们实际设置而不是
value=""
- 在服务器端检查请求的值通过
dd($request->all())
- 确保你的字段存在于你模型的
$fillable
数组中
英文:
some things to do:
- inspect the values of your options to check if they are actually set and not
value=""
- inspect the values of your request server side by
dd($request->all())
- make sure your fields exist in your model's
$fillable
array
答案2
得分: 0
检查请求中的created_by
和updated_by
值是否有效或无效。
dd($request->created_by)
dd($request->updated_by)
英文:
Check if the created_by
and updated_by
values from request is valid or not
dd($request->created_by)
dd($request->updated_by)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论