/**
  * Get the rules.
  *
  * @return array
  */
 public function getRules()
 {
     $rules = parent::getRules();
     if ($min = array_get($this->getConfig(), 'min')) {
         $rules[] = 'min:' . $min;
     }
     if ($max = array_get($this->getConfig(), 'max')) {
         $rules[] = 'max:' . $max;
     }
     return $rules;
 }
Пример #2
0
 /**
  * Get the rules.
  *
  * @return array
  */
 public function getRules()
 {
     $rules = parent::getRules();
     if ($image = array_get($this->getConfig(), 'image')) {
         $rules[] = 'image';
     }
     if ($mimes = array_get($this->getConfig(), 'mimes')) {
         if (in_array('jpg', $mimes) || in_array('jpeg', $mimes)) {
             $mimes = array_unique(array_merge($mimes, ['jpg', 'jpeg']));
         }
         $rules[] = 'mimes:' . implode(',', $mimes);
     }
     if ($max = array_get($this->getConfig(), 'max')) {
         $rules[] = 'max:' . $max * 1000;
     }
     return $rules;
 }
 /**
  * Get the rules.
  *
  * @return array
  */
 public function getRules()
 {
     $rules = parent::getRules();
     // We expect an array.
     $rules[] = 'array';
     // Set amount of inputs to expect.
     switch (array_get($this->getConfig(), 'mode')) {
         case 'datetime':
             $rules[] = 'size:3';
             break;
         case 'time':
             $rules[] = 'size:2';
             break;
         case 'date':
             $rules[] = 'size:1';
             break;
     }
     return $rules;
 }