offsetExists() public method

Determine if the given attribute exists.
public offsetExists ( mixed $offset ) : boolean
$offset mixed
return boolean
Exemplo n.º 1
0
 /**
  * The default error bag.
  *
  * @var string
  */
 private function getValidationData($table, $keys, Model $model = NULL)
 {
     $config = app('config')->get('validation.' . $table);
     $keys == '*' && ($keys = array_keys($config));
     $validation_data = array_keyfilter($config, $keys);
     $rules = $messages = $attributes = [];
     foreach ($validation_data as $k => $v) {
         empty($v['rules']) && ($v['rules'] = []);
         !is_array($v['rules']) && ($v['rules'] = explode('|', $v['rules']));
         foreach ($v['rules'] as &$vv) {
             $vv = str_replace(',{{attribute}}', ',' . $k, $vv);
             $vv = preg_replace_callback('/,\\{\\{([a-z0-9_\\-]*)\\}\\}/i', function ($matches) use($model) {
                 return !empty($model) ? $model->offsetExists($matches[1]) ? ',' . $model->getAttribute($matches[1]) : '' : '';
             }, $vv);
         }
         isset($v['rules']) && ($rules[$k] = $v['rules']);
         isset($v['message']) && ($messages[$k] = $v['message']);
         isset($v['name']) && ($attributes[$k] = $v['name']);
     }
     return compact('rules', 'messages', 'attributes');
 }
Exemplo n.º 2
0
 public function offsetExists($offset)
 {
     return $this->model->offsetExists($offset);
 }