本文整理汇总了PHP中Validation::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Validation::execute方法的具体用法?PHP Validation::execute怎么用?PHP Validation::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validation
的用法示例。
在下文中一共展示了Validation::execute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeFormValidation
private function executeFormValidation()
{
$validation = new Validation($this->myView->data);
$fields['title'] = ['Mandatory'];
$fields['text'] = ['Mandatory'];
return $validation->execute($fields);
}
示例2: executeFormValidation
protected function executeFormValidation()
{
$validation = new Validation($this->myView->data);
$fields['name'] = ['Mandatory'];
$fields['email'] = ['Mandatory', 'ValidEmail', 'DuplicateAccount'];
// Verifica senha somente na criação do usuário
if (!$this->myView->data->id) {
$fields['password'] = ['Mandatory'];
}
return $validation->execute($fields);
}
示例3: executeFormValidation
protected function executeFormValidation()
{
$validation = new Validation($this->myView->data);
if ($this->addressIsMandatory) {
$fields['street'] = ['Mandatory'];
$fields['number'] = ['Mandatory', 'OnlyNumbers'];
$fields['local'] = ['Mandatory'];
$fields['city'] = ['Mandatory'];
$fields['state'] = ['Mandatory'];
$fields['zipcode'] = ['Mandatory', 'ValidCEP'];
}
return $validation->execute($fields);
}
示例4: edit
public function edit($id, $fields)
{
$this->errors = [];
$id = (int) $id;
$valid = new Validation($this->table);
$valid->execute($fields, $id);
if ($valid->good()) {
$this->last_valid_obj = $valid->getObj();
$this->db->update($this->table, $this->last_valid_obj, "{$this->pk}=:{$this->pk}", [$this->pk => $id]);
return true;
}
$this->errors = $valid->errors();
return false;
}
示例5: executeFormValidation
protected function executeFormValidation()
{
$validation = new Validation($this->myView->data);
$fields['login'] = ['Mandatory', 'DuplicateUser'];
$fields['name'] = ['Mandatory'];
$fields['email'] = ['Mandatory', 'ValidEmail'];
// Verifica senha somente na criação do usuário
if (!$this->myView->data->id) {
$fields['password'] = ['Mandatory'];
}
// Verifica se usuário possui permissão para alterar o Controle de Acessos
foreach ($_SESSION['admLogin']->getRoles() as $role) {
if ($role->rolePageID == explode(".", $this->myView->getPageId())[0]) {
$fields['roles'] = ['MandatoryCombo'];
}
}
return $validation->execute($fields);
}
示例6: executeFormValidation
private function executeFormValidation()
{
$validation = new Validation($this->myView->data);
switch ($this->action) {
case 'typeDetail':
case 'brandDetail':
$fields['title'] = ['Mandatory'];
break;
case 'typeNewFeature':
$fields['feature'] = ['Mandatory'];
break;
}
return $validation->execute($fields);
}
示例7: executeFormValidation
protected function executeFormValidation()
{
$validation = new Validation($this->myView->data);
switch ($this->action) {
case 'detail':
if ($this->myView->data->status == Config::read('order.status')['sent']) {
$fields['tracking'] = ['Mandatory'];
}
break;
}
return $validation->execute($fields);
}
示例8: executeFormValidation
protected function executeFormValidation()
{
$validation = new Validation($this->myView->data);
if ($this->myView->data->status != Config::read('product.status')['approved']) {
$fields['name'] = ['Mandatory'];
$fields['text'] = ['Mandatory'];
$fields['type'] = ['Mandatory'];
$fields['price'] = ['Mandatory', 'ValidPrice'];
}
$fields['discount'] = ['ValidPrice'];
return $validation->execute($fields);
}
示例9: executeFormValidation
protected function executeFormValidation()
{
$validation = new Validation($this->myView->data);
// Transfere callback para métodos respectivos
switch ($this->action) {
case 'myAccount':
$fields['name'] = ['Mandatory'];
$fields['surname'] = ['Mandatory'];
$fields['cpf'] = ['Mandatory', 'ValidCPF'];
$fields['phone'] = ['Mandatory', 'ValidPhone'];
$fields['cellphone'] = ['ValidPhone'];
break;
case 'newAccount':
$fields['name'] = ['Mandatory'];
$fields['surname'] = ['Mandatory'];
$fields['email'] = ['Mandatory', 'ValidEmail', 'DuplicateAccount'];
$fields['password'] = ['Mandatory'];
break;
case 'password':
$fields['email'] = ['Mandatory', 'ValidEmail'];
break;
}
$return = $validation->execute($fields);
// Mescla retorno da classe com validação de endereço
if ($this->action == 'myAccount') {
$return['error'] = $return['error'] || $this->__executeAddressFormValidation()['error'];
$return['messages'] = array_merge($return['messages'], $this->__executeAddressFormValidation()['messages']);
}
return $return;
}