我在迁移中向表中添加一个字段,我希望允许它为NULL但我希望它默认为NULL。我在默认方法中放置了什么?我担心将"NULL"
放入会尝试放置一串NULL
,其中我显然不想要。请帮助:)
Schema::table('item_categories', function(Blueprint $table)
{
$table->integer('parent_item_category_id')->unsigned()->nullable()->default($what_to_put here);
});
答案 0 :(得分:88)
在字段上使用nullable()
方法时,该字段将默认为NULL。