<?php
 namespace VnChocola\Model;
 use TCMS\Model;
 use TCMS\FieldModel;
 use FIELD_DATA_TYPE;
 class CarCompartmentsModel extends Model {
 public $tableName = 'CarCompartments';
 public $timestamp = true;
 public function registerField() {
 $this->addField('id', FIELD_DATA_TYPE::STRING);
 $this->addField('title', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->required = true;
 $field->displayName = lang('CarCompartment_model.name');
 }
);
 $this->addField('sort_index', FIELD_DATA_TYPE::INTEGER, function(FieldModel $field) {
 $field->defaultValue = 0;
 $field->displayName = lang('CarCompartment_model.sort_index');
 }
);
 $this->addField('group', FIELD_DATA_TYPE::SELECT, function(FieldModel $field) {
 $field->required = true;
 $field->displayName = lang('CarCompartment_model.group');
 $field->setDataSource('CarCompartmentGroupModel', 'name', 'id', '-' . lang('master.choose') . '-');
 }
);
 $this->addField('branchID', FIELD_DATA_TYPE::STRING, function(FieldModel $field) {
 $field->displayName = lang('branch_model.name');
 $field->setDataSource('BranchsModel', 'name', 'id', lang('branch_model.choose_default'));
 $field->showInCreatePage = false;
 $field->showInUpdatePage = false;
 }
);
 }
 }
