Properties

$items

$items : 

Type

Methods

__construct()

__construct(  $items = array()) 

Parameters

$items

make()

make(  $items = array()) 

Parameters

$items

isEmpty()

isEmpty() : boolean

是否为空

Returns

boolean

toArray()

toArray() 

all()

all() 

merge()

merge(mixed  $items) : static

合并数组

Parameters

mixed $items

Returns

static

diff()

diff(mixed  $items) : static

比较数组,返回差集

Parameters

mixed $items

Returns

static

flip()

flip() : static

交换数组中的键和值

Returns

static

intersect()

intersect(mixed  $items) : static

比较数组,返回交集

Parameters

mixed $items

Returns

static

keys()

keys() : static

返回数组中所有的键名

Returns

static

pop()

pop() : mixed

删除数组的最后一个元素(出栈)

Returns

mixed

reduce()

reduce(callable  $callback, mixed  $initial = null) : mixed

通过使用用户自定义函数,以字符串返回数组

Parameters

callable $callback
mixed $initial

Returns

mixed

reverse()

reverse() : static

以相反的顺序返回数组。

Returns

static

shift()

shift() : mixed

删除数组中首个元素,并返回被删除元素的值

Returns

mixed

chunk()

chunk(integer  $size, boolean  $preserveKeys = false) : static

把一个数组分割为新的数组块.

Parameters

integer $size
boolean $preserveKeys

Returns

static

unshift()

unshift(mixed  $value, null  $key = null) : integer

在数组开头插入一个元素

Parameters

mixed $value
null $key

Returns

integer

each()

each(callable  $callback) : $this

给每个元素执行个回调

Parameters

callable $callback

Returns

$this

filter()

filter(callable|null  $callback = null) : static

用回调函数过滤数组中的元素

Parameters

callable|null $callback

Returns

static

column()

column(string  $column_key, string|null  $index_key = null) : array

返回数组中指定的一列

Parameters

string $column_key
string|null $index_key

Returns

array

sort()

sort(callable|null  $callback = null) : static

对数组排序

Parameters

callable|null $callback

Returns

static

shuffle()

shuffle() : static

将数组打乱

Returns

static

slice()

slice(integer  $offset, integer  $length = null, boolean  $preserveKeys = false) : static

截取数组

Parameters

integer $offset
integer $length
boolean $preserveKeys

Returns

static

offsetExists()

offsetExists(  $offset) 

Parameters

$offset

offsetGet()

offsetGet(  $offset) 

Parameters

$offset

offsetSet()

offsetSet(  $offset,   $value) 

Parameters

$offset
$value

offsetUnset()

offsetUnset(  $offset) 

Parameters

$offset

count()

count() 

getIterator()

getIterator() 

jsonSerialize()

jsonSerialize() 

toJson()

toJson(integer  $options = JSON_UNESCAPED_UNICODE) : string

转换当前数据集为JSON字符串

Parameters

integer $options

json参数

Returns

string

__toString()

__toString() 

load()

load(mixed  $relation) : $this

延迟预载入关联查询

Parameters

mixed $relation

关联

Returns

$this

hidden()

hidden(array  $hidden = array(), boolean  $override = false) : $this

设置需要隐藏的输出属性

Parameters

array $hidden

属性列表

boolean $override

是否覆盖

Returns

$this

visible()

visible(array  $visible = array(), boolean  $override = false) : $this

设置需要输出的属性

Parameters

array $visible
boolean $override

是否覆盖

Returns

$this

append()

append(array  $append = array(), boolean  $override = false) : $this

设置需要追加的输出属性

Parameters

array $append

属性列表

boolean $override

是否覆盖

Returns

$this

convertToArray()

convertToArray(mixed  $items) : array

转换成数组

Parameters

mixed $items

Returns

array