Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * 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;
 }
 /**
  * Get the files under validation.
  *
  * @return array
  */
 public function getFiles()
 {
     return $this->validator->getFiles();
 }
Пример #4
0
 /**
  * Guarda los archivos de la factura en el disco.
  *
  * @access protected
  * @param  Factura  $factura
  * @param  \Illuminate\Validation\Validator $validacion
  * @return Factura Object
  */
 protected function saveArchivosFactura(Factura $factura, \Illuminate\Validation\Validator $validacion)
 {
     foreach ($validacion->getFiles() as $key => $archivo) {
         $carpeta = $this->carpetaFactura($factura);
         $rnombre = $this->rnombreArchivo($archivo->getMimeType());
         $archivo->move(public_path($carpeta), $rnombre);
         // guardamos la nueva ruta del archivo en el atributo del modelo
         // Factura:
         $factura->{$key} = $this->normalizePath($carpeta, $rnombre);
     }
     return $factura;
 }