Exemplo n.º 1
0
 public function buildForm()
 {
     $this->add($this->model->getKeyName(), 'hidden')->add('email', 'email', ['label' => trans('expendable::form.email'), 'validation' => 'required,custom[email]']);
     $id = $this->model->getKey();
     if (!empty($id)) {
         $this->add('change_password', 'checkbox', ['default_value' => 1, 'label' => trans('expendable::form.change_password_help'), 'checked' => false, 'noInEditView' => true]);
     }
     $this->add('password', 'password', ['label' => trans('expendable::form.password'), 'attr' => ['id' => 'password'], 'validation' => 'required', 'noInEditView' => true])->add('password_match', 'password', ['label' => trans('expendable::form.repeat_password'), 'validation' => 'required,equals[password]', 'noInEditView' => true])->add('status', 'choice', ['choices' => StaticLabel::status(), 'empty_value' => '-', 'validation' => 'required', 'label' => trans('expendable::form.status')])->add('role_id', 'choice', ['choices' => Role::getChoice(), 'empty_value' => '-', 'validation' => 'required', 'label' => trans('expendable::form.role')])->addDefaultActions();
 }