data = $data; return Helper::array(Arr::get($data, $this->column, $this->value)); } /** * {@inheritdoc} */ public function getValidator(array $input) { if ($this->validator) { return $this->validator->call($this, $input); } if (! is_string($this->column)) { return false; } $rules = $attributes = []; if (! $fieldRules = $this->getRules()) { return false; } if (! Arr::has($input, $this->column)) { return false; } $rules["{$this->column}.keys.*"] = 'distinct'; $rules["{$this->column}.values.*"] = $fieldRules; $attributes["{$this->column}.keys.*"] = __('Key'); $attributes["{$this->column}.values.*"] = __('Value'); $input = $this->prepareValidatorInput($input); return validator($input, $rules, $this->getValidationMessages(), $attributes); } protected function prepareValidatorInput(array $input) { Arr::forget($input, $this->column.'.'.static::DEFAULT_FLAG_NAME); return $input; } protected function addScript() { $value = old($this->column, $this->value()); $number = $value ? count($value) : 0; $class = $this->getElementClassString(); $this->script = <<addScript(); Admin::style('td .form-group {margin-bottom: 0 !important;}'); return parent::render(); } }