update database

This commit is contained in:
2020-12-09 14:45:49 +07:00
parent ee3c869d71
commit 24e3347d43
4 changed files with 17 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ use Yii;
* This is the model class for table "list_management".
*
* @property int $id
* @property int $code
* @property string $type
* @property string $name
* @property string $image
@@ -16,6 +17,7 @@ use Yii;
* @property string $telephone
* @property string $address
* @property int $time
* @property int $last_modified
*/
class ListManagement extends \yii\db\ActiveRecord {
@@ -32,7 +34,7 @@ class ListManagement extends \yii\db\ActiveRecord {
public function rules() {
return [
[['type', 'name', 'gender', 'telephone', 'address', 'image'], 'string'],
[['birthday', 'time'], 'integer'],
[['birthday', 'time', 'code', 'last_modified'], 'integer'],
];
}
@@ -42,6 +44,7 @@ class ListManagement extends \yii\db\ActiveRecord {
public function attributeLabels() {
return [
'id' => 'ID',
'code' => 'Code',
'type' => 'Type',
'name' => 'Name',
'image' => 'Registration Image',
@@ -49,12 +52,14 @@ class ListManagement extends \yii\db\ActiveRecord {
'birthday' => 'Birthday',
'telephone' => 'Telephone',
'address' => 'Address',
'time' => 'Registration time'
'time' => 'Registration time',
'last_modified' => 'Last Modified'
];
}
public function create($data) {
$r = $this->load([
'code' => $data['Code'],
'type' => $data['type'],
'name' => $data['name'],
'image' => $data['image'],
@@ -62,7 +67,8 @@ class ListManagement extends \yii\db\ActiveRecord {
'birthday' => $data['birthday'] === "" ? 0 : date_format(date_create_from_format('d/m/Y', $data['birthday']), 'U'),
'telephone' => $data['telephone'],
'address' => $data['address'],
'time' => time()
'time' => time(),
'last_modified' => time()
], '');
if ($r) {
try {