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

前端 未结 2 1183
独厮守ぢ
独厮守ぢ 2021-01-01 19:40

I\'m using Laravel and Eloquent for two years and today I\'ve decided to install a fresh Laravel 5.3 and try something with it.

I used an old database schema of mine

2条回答
  •  悲&欢浪女
    2021-01-01 19:57

    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.

提交回复
热议问题