mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-09 08:02:48 +08:00
修正集合类
This commit is contained in:
@@ -42,7 +42,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
||||
|
||||
public function toArray($allow = [])
|
||||
{
|
||||
return array_map(function ($value) {
|
||||
return array_map(function ($value) use ($allow) {
|
||||
return ($value instanceof Model || $value instanceof self) ? $value->toArray($allow) : $value;
|
||||
}, $this->items);
|
||||
}
|
||||
@@ -229,7 +229,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
||||
$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;
|
||||
@@ -369,6 +369,6 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
|
||||
if ($items instanceof self) {
|
||||
return $items->all();
|
||||
}
|
||||
return (array) $items;
|
||||
return (array)$items;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user