public function dbInstall() { $db = Yii::$app->db; $tableOptions = null; if ($db->driverName === 'mysql') { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=MyISAM'; } $db->createCommand()->createTable(Member::tableName(), ['id' => Schema::TYPE_PK, 'username' => Schema::TYPE_STRING . ' NOT NULL', 'auth_key' => Schema::TYPE_STRING . '(32) NOT NULL', 'password_hash' => Schema::TYPE_STRING . ' NOT NULL', 'password_reset_token' => Schema::TYPE_STRING, 'email' => Schema::TYPE_STRING . ' DEFAULT NULL', 'first_name' => Schema::TYPE_STRING . ' DEFAULT NULL', 'last_name' => Schema::TYPE_STRING . ' DEFAULT NULL', 'avatar' => Schema::TYPE_STRING . ' DEFAULT NULL', 'birth' => Schema::TYPE_DATE . ' DEFAULT NULL', 'address' => Schema::TYPE_TEXT . ' DEFAULT NULL', 'zip' => Schema::TYPE_STRING . '(10) DEFAULT NULL', 'phone' => Schema::TYPE_STRING . '(100) DEFAULT NULL', 'role' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', 'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', 'created_at' => Schema::TYPE_INTEGER . ' NOT NULL', 'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL'], $tableOptions)->execute(); }
public function actionDelete($id) { if ($model = Member::findOne($id)) { $model->delete(); } else { $this->error = Yii::t('easyii', 'Not found'); } return $this->formatResponse(Yii::t('easyii/menu', 'News deleted')); }