|
@@ -122,7 +122,11 @@ class Base extends Model |
|
@@ -122,7 +122,11 @@ class Base extends Model |
|
122
|
* @method post
|
122
|
* @method post
|
|
123
|
*/
|
123
|
*/
|
|
124
|
public function add($data){
|
124
|
public function add($data){
|
|
125
|
- return $this->save($data);
|
125
|
+ if(!isset($data['created_at'])){
|
|
|
|
126
|
+ $data['created_at'] = date('Y-m-d H:i:s');
|
|
|
|
127
|
+ }
|
|
|
|
128
|
+ $data['updated_at'] = $data['created_at'];
|
|
|
|
129
|
+ return $this->insert($data);
|
|
126
|
}
|
130
|
}
|
|
127
|
|
131
|
|
|
128
|
/**
|
132
|
/**
|
|
@@ -136,7 +140,8 @@ class Base extends Model |
|
@@ -136,7 +140,8 @@ class Base extends Model |
|
136
|
unset($data['id']);
|
140
|
unset($data['id']);
|
|
137
|
}
|
141
|
}
|
|
138
|
$query = $this->formatQuery($condition);
|
142
|
$query = $this->formatQuery($condition);
|
|
139
|
- return $query->save($data);
|
143
|
+ $data['updated_at'] = date('Y-m-d H:i:s');
|
|
|
|
144
|
+ return $query->update($data);
|
|
140
|
|
145
|
|
|
141
|
}
|
146
|
}
|
|
142
|
/**
|
147
|
/**
|