laravel 5.6中的自定义字段默认使用auth导致错误

时间:2018-04-24 13:40:11

标签: php laravel

在发布此问题之前,我已经提到了How to add custom field in default registration form of Laravel 5.6?

但我的问题无法解决。我想在我的laravel 5.6全新安装中添加自定义字段,默认为make:auth。

这是我用于创建用户表的迁移

enter image description here

这是我的auth注册用户,我在这里实现了自定义字段

enter image description here

这里是我的模型user.php的可填充数组,它扩展了真实性

enter image description here

这是来自寄存器控制器的dd()响应

enter image description here

最后,这是我在完成所有这些工作后得到的错误。

enter image description here

任何帮助将不胜感激。 提前致谢。

2 个答案:

答案 0 :(得分:1)

您的表格列名称必须为" fname"不是" Fname"

答案 1 :(得分:0)

直接在mysql表列中添加默认值fname default = null 或如果已经完成迁移,请先执行PHP迁移回滚,然后在up函数中添加新的迁移

 Schema::table('users', function (Blueprint $table) {
       $table->string('fname')->nullable();
      });
相关问题