Laravel"无效的日期时间格式:1366"

时间:2018-01-29 17:23:04

标签: php mysql laravel datetime

实际上我正在按照Youtube教程(Laravel 5.5)与Laravel建立博客。我正在添加个人资料页面"姓名,名称,个人资料照片"。我得到错误"无效的日期时间格式:1366"。

  

Illuminate \ Database \ QueryException(22007)
  SQLSTATE [22007]:无效的日期时间格式:1366不正确的整数值:' {" id":1," name":" Sujan Nepal",& #34;电子邮件":" sujan@gmail.com"," created_at":" 2018-01-26 16:18:56",&# 34; updated_at":" 2018-01-26 16:18:56"}'对于列' user_id'在第1行(SQL:插入profilesuser_idnamedesignationprofile_picupdated_atcreated_at)值({" id":1," name":" Sujan Nepal"," email":" sujan @ gmail。 com"," created_at":" 2018-01-26 16:18:56"," updated_at":" 2018-01-26 16:18:56"},Sujan Nepal,开发人员,http://localhost/myblog/public/uploads/IMG_0251.JPG,2018-01-29 16:53:31,2018-01-29 16:53:31))

实际上我认为它是因为插入图像而出现的,但我无法解决它。

请建议我如何解决这个问题。

Screenshot of error

2 个答案:

答案 0 :(得分:0)

根据评论中的代码,您有以下这一行:

$profiles->user_id = Auth::user();

应该是:

$profiles->user_id = Auth::user()->id;

这里发生的是您将user_id属性设置为从User返回的整个Auth::user()对象。当对象点击数据库驱动程序时,它可能会使用toString(),这看起来像是序列化为json字符串。

答案 1 :(得分:0)

对于像我这样的新来者,您必须检查

{{ $party->id }}

Party Model中的Party变量。您必须通过

id

与此。确保插入刀片。只需通过

  

id到变量。

希望你!知道了。