<?php
 namespace VnChocola\Model;
 use TCMS\Model;
 use TCMS\FieldModel;
 use FIELD_DATA_TYPE;
 class RolesModel extends Model {
 public $tableName = 'Roles';
 public function registerField() {
 $this->addField('id', FIELD_DATA_TYPE::STRING);
 $this->addField('name', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = true;
 $field->displayName = lang('model.name');
 }
);
 $this->addField('key', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = true;
 $field->description = lang('model.key_desc');
 $field->validate = [ 'unique' => lang('model.key_exist') ];
 }
);
 $this->addField('group_name', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = true;
 $field->displayName = lang('model.group_name');
 }
);
 }
 }
