예제 #1
0
 /**
  * validation state helper
  *
  * @param \Illuminate\Support\ViewErrorBag $errors
  * @param array|string                     $names
  * @param string                           $context
  * @return string
  */
 function validation_state(Illuminate\Support\ViewErrorBag $errors, $names, $context = 'has-danger')
 {
     //normalize input to array
     if (!is_array($names)) {
         $names = [$names];
     }
     //check if error exists
     foreach ($names as $name) {
         if ($errors->has($name)) {
             return $context;
         }
     }
     //no error
     return '';
 }
예제 #2
0
파일: Formr.php 프로젝트: perkola/formr
 /**
  * Build the error component.
  * @param  Illuminate\Support\ViewErrorBag $errors
  * @param  string $name
  * @return string
  */
 protected function buildError($errors, $name)
 {
     return '<small class="error">' . $errors->first($name) . '</small>';
 }