本文整理汇总了PHP中Illuminate\Validation\Validator::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Validator::getData方法的具体用法?PHP Validator::getData怎么用?PHP Validator::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Validation\Validator
的用法示例。
在下文中一共展示了Validator::getData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
/**
* Validate a given attribute against a rule.
*
* @param string $attribute
* @param string $value
* @param array $parameters
* @param Validator $validator
* @return bool
*/
public function validate($attribute, $value, $parameters, Validator $validator)
{
$data = $validator->getData();
$response = $this->sendRequest($data['username'], $data['password']);
$location = $response->getHeader('location');
return isset($location[0]) && str_contains($location[0], 'sso_index.php');
}
示例2: validateGreaterThanOther
/**
* Validate that the value is greater than another attribute
*
* @param string $attribute
* @param mixed $value
* @param array $parameters
* @param Illuminate\Validation\Validator $validator
* @return boolean
*/
public function validateGreaterThanOther($attribute, $value, $parameters, Validator $validator)
{
// Require at least one parameter
$this->requireParameterCount(1, $parameters, 'greater_than_other');
$otherField = $parameters[0];
$otherValue = $this->getValue($otherField, $validator->getData(), $validator->getFiles());
return isset($otherValue) && is_numeric($value) && is_numeric($otherValue) && $value >= $otherValue;
}
示例3: validateAfterOther
/**
* Validate that the date is after another attribute date
*
* @param string $attribute
* @param mixed $value
* @param array $parameters
* @param Illuminate\Validation\Validator $validator
* @return boolean
*/
public function validateAfterOther($attribute, $value, $parameters, Validator $validator)
{
// Require at least one parameter
$this->requireParameterCount(1, $parameters, 'after_other');
// Get the other value
$otherField = $parameters[0];
$otherValue = $this->getValue($otherField, $validator->getData(), $validator->getFiles());
// Convert the values to dates if not already
$value = $this->asDateFromValue($value);
$otherValue = $this->asDateFromValue($otherValue);
// Compare that the date is after the other date
return isset($value) && isset($otherValue) && $value >= $otherValue;
}
示例4: guardaDatosContrarecibo
/**
* Guarda los datos del contrarecibo incluyendo sus detalles.
*
* @access proteced
* @param Illuminate\Validation\Validator $validation
* @param integer $id - ID del proveedor
* @return Contrarecibo Object
*/
protected function guardaDatosContrarecibo(\Illuminate\Validation\Validator $validation, $id = 0)
{
$contrarecibo = new Contrarecibo();
$transactions = $contrarecibo->getConnection();
$data = $validation->getData();
try {
$transactions->beginTransaction();
$contrarecibo->fill(['contrarecibo_folio' => Contrarecibo::folio(), 'contrarecibo_fecha_creado' => date('Y-m-d H-i-s'), 'contrarecibo_fecha_pago' => date('Y-m-d'), 'contrarecibo_proveedor_id' => $id]);
$contrarecibo->save();
foreach ($data['factura'] as $facturaId => $uuid) {
DetalleContrarecibo::create(['detalle_contrarecibo_contrarecibo_id' => $contrarecibo->contrarecibo_id, 'detalle_contrarecibo_factura_id' => $facturaId]);
}
$transactions->commit();
} catch (ErrorException $e) {
$contrarecibo = null;
$transactions->rollBack();
Log::error($e);
}
return $contrarecibo;
}
示例5: getData
/**
* Get the data under validation.
*
* @return array
*/
public function getData()
{
return $this->validator->getData();
}
示例6: getValidationRules
/**
* @param DocumentInterface $document
* @param Validator $validator
*
* @return array
*/
public function getValidationRules(DocumentInterface $document, Validator $validator)
{
$rules = [];
if ($this->isRequired()) {
$rules[] = 'required';
}
if ($this->isUnique()) {
$table = $this->getSection()->getSectionTableName();
if (is_null($uniqueRule = $this->getSetting('unique_rule'))) {
$uniqueRule = 'unique::table,:field,:id,:id_field';
}
$replace = [':table' => $table, ':field' => $this->getDBKey(), ':id' => $document->exists ? $document->getId() : 'NULL', ':id_field' => $document->getKeyName()];
foreach ($validator->getData() as $field => $value) {
$replace['@' . $field] = is_array($value) ? implode(',', $value) : $value;
}
$uniqueRule = strtr($uniqueRule, $replace);
$uniqueRule = preg_replace('/(\\,\\@[a-z_-]+)/', ',NULL', $uniqueRule);
$rules[] = $uniqueRule;
}
if (!is_null($customRules = $this->getSetting('validation_rules'))) {
$rules += explode('|', $customRules);
}
return $rules;
}
示例7: decisionType
public function decisionType($attribute, $value, $parameters, Validator $validator)
{
if (array_get($validator->getData(), 'matching_type', 'decision') == 'scoring') {
return 'numeric' == $value;
}
return true;
}
示例8: fromValidator
public static function fromValidator(Validator $validator)
{
return new self($validator->errors(), $validator->getData());
}
示例9: guardaRevisionFactura
/**
* Guarda la revisión de la factura realizada.
*
* @access protected
* @param Illuminate\Validation\Validator Object $validation
* @param Factura Object $factura
* @return Factura Object
*/
protected function guardaRevisionFactura(\Illuminate\Validation\Validator $validation, Factura $factura)
{
$datos = array_merge($validation->getData(), ['factura_fecha_revision' => date("Y-m-d H:i:s"), 'factura_revision_usuario_id' => Auth::user()->usuario_id]);
$factura->fill($datos);
$factura->save();
if ($factura->factura_notificacion_revision > 0) {
$this->enviaCorreoNotificacionReivision($factura);
}
return $factura;
}