后台批量操作bug修复

内核更新
This commit is contained in:
2016-07-11 12:03:55 +08:00
parent 195ec9417c
commit 6460d64ceb
19 changed files with 119 additions and 128 deletions

View File

@@ -40,10 +40,10 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
return empty($this->items);
}
public function toArray($allow = [])
public function toArray()
{
return array_map(function ($value) {
return ($value instanceof Model || $value instanceof self) ? $value->toArray($allow) : $value;
return ($value instanceof Model || $value instanceof self) ? $value->toArray() : $value;
}, $this->items);
}
@@ -225,11 +225,11 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
$result = [];
foreach ($this->items as $row) {
$key = $value = null;
$key = $value = null;
$keySet = $valueSet = false;
if (null !== $index_key && array_key_exists($index_key, $row)) {
$keySet = true;
$key = (string) $row[$index_key];
$key = (string)$row[$index_key];
}
if (null === $column_key) {
$valueSet = true;
@@ -344,13 +344,12 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
/**
* 转换当前数据集为JSON字符串
* @access public
* @param array $allow 允许输出的属性列表
* @param integer $options json参数
* @param integer $options json参数
* @return string
*/
public function toJson($allow = [], $options = JSON_UNESCAPED_UNICODE)
public function toJson($options = JSON_UNESCAPED_UNICODE)
{
return json_encode($this->toArray($allow), $options);
return json_encode($this->toArray(), $options);
}
public function __toString()
@@ -369,6 +368,6 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
if ($items instanceof self) {
return $items->all();
}
return (array) $items;
return (array)$items;
}
}