This commit is contained in:
ichynul 2021-06-01 00:47:16 +08:00
parent e559a301a8
commit 7605f1c414
2 changed files with 12 additions and 6 deletions

View File

@ -1,7 +1,7 @@
# tpextbuilder
## 文档
<https://gitee.com/ichynul/myadmin/wikis/pages>
<https://gitee.com/tpext/myadmin/wikis/pages>
#### 集成富文本编辑器
* ckeditor

View File

@ -236,7 +236,7 @@ class Field implements Fillable
/**
* Undocumented function
*
* @param string $val
* @param string|\Closure $val
* @return $this
*/
public function to($val)
@ -822,8 +822,8 @@ EOT;
* Undocumented function
*
* @param array $groupArr
* @example location1 [[values1, $class1, $field1, $logic1], [values2, $class2, $field2, $logic2], ... ]
* @example location2 ['class1' => [values1, $field1, $logic1], 'class2'=> [values2, $field2, $logic2], ... ]
* @example location1 [[$values1, $class1, $field1, $logic1], [$values2, $class2, $field2, $logic2], ... ]
* @example location2 ['class1' => [$values1, $field1, $logic1], 'class2'=> [$values2, $field2, $logic2], ... ]
* @example location3 ['class1' => function closure1(){...}, 'class2'=> function closure2(){...}, ... ]
* @return $this
*/
@ -986,7 +986,13 @@ EOT;
protected function parseToValue($value)
{
$data = $this->data instanceof Model ? $this->data->toArray() : $this->data;
$data = $this->data;
$to = $this->to;
if ($to instanceof \Closure) {
return $to($value, $data);
}
$keys = ['{val}', '{__val__}'];
$replace = [$value, $value];
@ -1003,7 +1009,7 @@ EOT;
$replace[] = $val;
}
$val = str_replace($keys, $replace, $this->to);
$val = str_replace($keys, $replace, $to);
$val = preg_replace('/\{\w+\.\w+\}/', '-', $val); //处理模型关联不上的情况