Laravel 5.3 Creating Models Returns “Field doesn't have a default value”

那年仲夏 提交于 2019-11-30 11:33:57

The reason for the error has been explained by @Nicklas.

The reason this is happening now, however, is that Laravel 5.3 uses strict mode for MySQL by default.

If you would like to revert to previous behavior, update your config/database.php file and set 'strict' => false for your connection.

You are trying to insert an object, with no 'URL' attribute, into a table that has a 'URL' column without a default value. So the database can't know what to do with that column.

You can do one of three things.

  1. Fill in the URL value in the create
  2. Change your schema to allow null insertion on URL
  3. Change the URL schema to include a default value. (empty string)

Post your migration or schema, if you need further help.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!