优化CRUD代码

pull/434/MERGE
Karson 2023-06-15 14:43:56 +08:00
parent b50e6c9cf0
commit 3c575e2383
1 changed files with 1 additions and 1 deletions

View File

@ -1,7 +1,7 @@
public function {%methodName%}($value, $data)
{
$value = $value ? $value : (isset($data['{%field%}']) ? $data['{%field%}'] : '');
$value = $value ?: ($data['{%field%}'] ?? '');
$valueArr = explode(',', $value);
$list = $this->{%listMethodName%}();
return implode(',', array_intersect_key($list, array_flip($valueArr)));