AL-zami
AL-zami

Reputation: 9066

can not get timestamp value inserted in my database table

i have a column called "joined" in my database "users" table which i have created using migration

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');
        });

But whenever i tried to insert a user in my table i get the following error

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list' (SQL: insert into users (username, password, full_name, email, joined, updated_at, created_at) values (alzami, y$ckR7d.Pt05QRNZXXRGkoOuWDTZAxtDiQ0XA4O2UktSuBd244Oc3qe, al zami rahman, [email protected], 20-03-16 10-37-11, 2016-03-20 10:37:11, 2016-03-20 10:37:11))

in my userController i have the following functionality to insert new user in my database

 $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();

Upvotes: 1

Views: 98

Answers (1)

Alexey Mezenin
Alexey Mezenin

Reputation: 163788

Eloquent is trying to get access to timesptamps which do not exist. Try to declare public $timestamps = false in a User model.

Upvotes: 2

Related Questions