Reputation: 299
this is my code
$model = Admin::create(Input::only('username', 'password', 'mobileNumber', 'firstName', 'lastName'));
echo $model->ID;
exit;
and the table admin
has just one more column which is ID
and it is primary key and auto increment
I got this exception:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list' (SQL: insert into
admin
(username
,password
,firstName
,lastName
,mobileNumber
,updated_at
,created_at
) values (samdari, azurial, samoad, adfasdf, 55545454, 2014-06-17 21:01:21, 2014-06-17 21:01:21))
Upvotes: 2
Views: 244
Reputation: 24661
You need to add this to your Admin
model:
public $timestamps = false;
Set to true if you want to automatically have created_at
and updated_at
fields, then create another migration for your table and add the columns in like this:
Schema::table('admin', function($table) {
$table->timestamps();
});
You can see more in the documentation section about Disabling Auto Timestamps
Upvotes: 2