无法在我的数据库表中插入时间戳值

时间:2016-03-20 10:41:25

标签: php mysql laravel timestamp

我有一个名为"加入"在我的数据库"用户"我使用迁移创建的表

Schema::create('users',function(Blueprint $table){

             $table->increments('user_id');
             $table->string('username',100);
             $table->string('password',300);
             $table->string('full_name',100);
             $table->string('email',100);
             $table->timestamp('joined');
        });

但每当我试图在我的表中插入用户时,我都会收到以下错误

  

SQLSTATE [42S22]:未找到列:1054未知列' updated_at'在   '字段列表' (SQL:插入usersusernamepassword,   full_nameemailjoinedupdated_atcreated_at)值   (alzami,y $ ckR7d.Pt05QRNZXXRGkoOuWDTZAxtDiQ0XA4O2UktSuBd244Oc3qe,al   zami rahman,alzami.shimanta @ gmail.com,20-03-16 10-37-11,2016-03-20   10:37:11,2016-03-20 10:37:11))

在我的userController中我有以下功能在我的数据库中插入新用户

 $user=new User();
            $user->username=$request->username;
            $user->password=bcrypt($request->password);
            $user->full_name=$request->full_name;
            $user->email=$request->email;
            $user->joined=date('d-m-y H-i-s');
            $user->save();

1 个答案:

答案 0 :(得分:2)

Eloquent试图访问不存在的timesptamps。尝试在public $timestamps = false模型中声明User