class Model_Usuario extends Orm\Model { protected static $_table_name = 'usuarios'; protected static $_properties = array( 'id' => array('type' => 'int'), 'username' => array( 'type' => 'varchar', 'label' => 'Nome completo', 'validation' => array('required', 'min_length' => array(8), 'max_length' => array(64)) ), 'email' => array( 'type' => 'varchar', 'label' => 'E-mail', 'validation' => array('required', 'valid_email') ), 'status' => array('type' => 'select', 'label' => 'Status', 'options' => array('0' => 'Inativo', '1' => 'Usuário', '2' => 'Administrador', '3' => 'Super Admin')) );
Fieldset::factory('usuario')->add_model('Model_Usuario')->build();
class Model_Usuario extends Orm\Model { protected static $_table_name = 'usuarios'; protected static $_properties = array( 'id' => array('data_type' => 'int'), 'username' => array( 'data_type' => 'varchar', 'label' => 'Nome completo', 'validation' => array('required', 'min_length' => array(8), 'max_length' => array(64)), 'form' => array('type' => 'text'), ), 'email' => array( 'label' => 'E-mail', 'validation' => array('required', 'valid_email'), 'form' => array('type' => 'varchar'), ), 'status' => array( 'label' => 'Status', 'form' => array( 'type' => 'select', 'options' => array('0' => 'Inativo', '1' => 'Usuário', '2' => 'Administrador', '3' => 'Super Admin') ), ), );
public function remove($fields) { if (is_array($fields)) { foreach ($fields as $field) { if (array_key_exists($field, $this->fields)) unset($this->fields[$field]); } return $this; } if (array_key_exists($fields, $this->fields)) unset($this->fields[$fields]); return $this; }
echo Fieldset::factory('article')->add_model($article)->remove('id)->build();
$field = $fieldset->add($p, ! empty($settings['label']) ? $settings['label'] : $p);to:
$field = $fieldset->add($p, ! empty($settings['label']) ? $settings['label'] : $p, ! empty($settings['form']) ? $settings['form'] : array());
'status' => array('type' => 'int', //<== the data type 'label' => 'Status', 'form' => array( 'type' => 'select', //<== the form type 'options' => array('0' => 'Inativo', '1' => 'Usuário', '2' => 'Administrador', '3' => 'Super Admin')))
echo Fieldset::factory('usuario')->add_model('Model_Usuario')->remove('id')->build();
It looks like you're new here. If you want to get involved, click one of these buttons!