日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Laravel Lumen 数组操作

發(fā)布時間:2024/1/1 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Laravel Lumen 数组操作 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

php原生:http://www.w3school.com.cn/php/php_ref_array.asp

Lumen方法:https://laravel.com/docs/5.6/helpers

Collections類方法:https://laravel.com/docs/5.6/collections?https://learnku.com/docs/laravel/5.8/collections/3916

PHP原生

array_column() 從二維數(shù)組取對應鍵的值,組成新數(shù)組 <?php // 表示由數(shù)據(jù)庫返回的可能記錄集的數(shù)組 $a = [['id' => 5698,'first_name' => 'Bill','last_name' => 'Gates',],['id' => 4767,'first_name' => 'Steve','last_name' => 'Jobs',],['id' => 3809,'first_name' => 'Mark','last_name' => 'Zuckerberg',] ];$last_names = array_column($a, 'last_name'); print_r($last_names); ?>

輸出

[ [0] => Gates[1] => Jobs[2] => Zuckerberg ] array_combine() 兩個數(shù)組組成新的二維數(shù)組,其中的一個數(shù)組是鍵名,另一個數(shù)組的值為鍵值 <?php $fname=array("Bill","Steve","Mark"); $age=array("60","56","31");$c=array_combine($fname,$age); print_r($c); ?>

?輸出

Array ( [Bill] => 60 [Steve] => 56 [Mark] => 31 )

下面是一些常用的原生函數(shù)

函數(shù)描述
array()創(chuàng)建數(shù)組。
array_change_key_case()把數(shù)組中所有鍵更改為小寫或大寫。
array_chunk()把一個數(shù)組分割為新的數(shù)組塊。
array_column()返回輸入數(shù)組中某個單一列的值。
array_combine()通過合并兩個數(shù)組來創(chuàng)建一個新數(shù)組。
array_count_values()用于統(tǒng)計數(shù)組中所有值出現(xiàn)的次數(shù)。
array_diff()比較數(shù)組,返回差集(只比較鍵值)。
array_diff_assoc()比較數(shù)組,返回差集(比較鍵名和鍵值)。
array_diff_key()比較數(shù)組,返回差集(只比較鍵名)。
array_diff_uassoc()比較數(shù)組,返回差集(比較鍵名和鍵值,使用用戶自定義的鍵名比較函數(shù))。
array_diff_ukey()比較數(shù)組,返回差集(只比較鍵名,使用用戶自定義的鍵名比較函數(shù))。
array_fill()用給定的鍵值填充數(shù)組。
array_fill_keys()用指定鍵名的給定鍵值填充數(shù)組。
array_filter()用回調(diào)函數(shù)過濾數(shù)組中的元素。
array_flip()交換數(shù)組中的鍵和值。
array_intersect()比較數(shù)組,返回交集(只比較鍵值)。
array_intersect_assoc()比較數(shù)組,返回交集(比較鍵名和鍵值)。
array_intersect_key()比較數(shù)組,返回交集(只比較鍵名)。
array_intersect_uassoc()比較數(shù)組,返回交集(比較鍵名和鍵值,使用用戶自定義的鍵名比較函數(shù))。
array_intersect_ukey()比較數(shù)組,返回交集(只比較鍵名,使用用戶自定義的鍵名比較函數(shù))。
array_key_exists()檢查指定的鍵名是否存在于數(shù)組中。
array_keys()返回數(shù)組中所有的鍵名。
array_map()把數(shù)組中的每個值發(fā)送到用戶自定義函數(shù),返回新的值。
array_merge()把一個或多個數(shù)組合并為一個數(shù)組。
array_merge_recursive()遞歸地合并一個或多個數(shù)組。
array_multisort()對多個數(shù)組或多維數(shù)組進行排序。
array_pad()用值將數(shù)組填補到指定長度。
array_pop()刪除數(shù)組的最后一個元素(出棧)。
array_product()計算數(shù)組中所有值的乘積。
array_push()將一個或多個元素插入數(shù)組的末尾(入棧)。
array_rand()返回數(shù)組中一個或多個隨機的鍵。
array_reduce()通過使用用戶自定義函數(shù),以字符串返回數(shù)組。
array_replace()使用后面數(shù)組的值替換第一個數(shù)組的值。
array_replace_recursive()遞歸地使用后面數(shù)組的值替換第一個數(shù)組的值。
array_reverse()以相反的順序返回數(shù)組。
array_search()搜索數(shù)組中給定的值并返回鍵名。
array_shift()刪除數(shù)組中首個元素,并返回被刪除元素的值。
array_slice()返回數(shù)組中被選定的部分。
array_splice()刪除并替換數(shù)組中指定的元素。
array_sum()返回數(shù)組中值的和。
array_udiff()比較數(shù)組,返回差集(只比較值,使用一個用戶自定義的鍵名比較函數(shù))。
array_udiff_assoc()比較數(shù)組,返回差集(比較鍵和值,使用內(nèi)建函數(shù)比較鍵名,使用用戶自定義函數(shù)比較鍵值)。
array_udiff_uassoc()比較數(shù)組,返回差集(比較鍵和值,使用兩個用戶自定義的鍵名比較函數(shù))。
array_uintersect()比較數(shù)組,返回交集(只比較值,使用一個用戶自定義的鍵名比較函數(shù))。
array_uintersect_assoc()比較數(shù)組,返回交集(比較鍵和值,使用內(nèi)建函數(shù)比較鍵名,使用用戶自定義函數(shù)比較鍵值)。
array_uintersect_uassoc()比較數(shù)組,返回交集(比較鍵和值,使用兩個用戶自定義的鍵名比較函數(shù))。
array_unique()刪除數(shù)組中的重復值。
array_unshift()在數(shù)組開頭插入一個或多個元素。
array_values()返回數(shù)組中所有的值。
array_walk()對數(shù)組中的每個成員應用用戶函數(shù)。
array_walk_recursive()對數(shù)組中的每個成員遞歸地應用用戶函數(shù)。
arsort()對關聯(lián)數(shù)組按照鍵值進行降序排序。
asort()對關聯(lián)數(shù)組按照鍵值進行升序排序。
compact()創(chuàng)建包含變量名和它們的值的數(shù)組。
count()返回數(shù)組中元素的數(shù)目。
current()返回數(shù)組中的當前元素。
each()返回數(shù)組中當前的鍵/值對。
end()將數(shù)組的內(nèi)部指針指向最后一個元素。
extract()從數(shù)組中將變量導入到當前的符號表。
in_array()檢查數(shù)組中是否存在指定的值。
key()從關聯(lián)數(shù)組中取得鍵名。
krsort()對數(shù)組按照鍵名逆向排序。
ksort()對數(shù)組按照鍵名排序。
list()把數(shù)組中的值賦給一些變量。
natcasesort()用“自然排序”算法對數(shù)組進行不區(qū)分大小寫字母的排序。
natsort()用“自然排序”算法對數(shù)組排序。
next()將數(shù)組中的內(nèi)部指針向前移動一位。
pos()current() 的別名。
prev()將數(shù)組的內(nèi)部指針倒回一位。
range()創(chuàng)建包含指定范圍單元的數(shù)組。
reset()將數(shù)組的內(nèi)部指針指向第一個元素。
rsort()對數(shù)組逆向排序。
shuffle()將數(shù)組打亂。
sizeof()count() 的別名。
sort()對數(shù)組排序。
uasort()使用用戶自定義的比較函數(shù)對數(shù)組中的鍵值進行排序。
uksort()使用用戶自定義的比較函數(shù)對數(shù)組中的鍵名進行排序。
usort()使用用戶自定義的比較函數(shù)對數(shù)組進行排序。

Lumen方法

array_only() 取數(shù)組對應鍵的值,組成新的數(shù)組 $request = $this->request->all();//['title' => 'test', 'content' => 'test', 'name' => 'test'] $condition = array_only($request, ['title', 'content']);

?輸出

['title' => 'test', 'content' => 'test']

方法列表

數(shù)組和對象

array_add()

array_add如果給定的鍵在數(shù)組中不存在,則該函數(shù)將給定的鍵/值對添加到數(shù)組中:

$array = array_add(['name' => 'Desk'], 'price', 100);// ['name' => 'Desk', 'price' => 100]

array_collapse()

該array_collapse函數(shù)將數(shù)組數(shù)組折疊為單個數(shù)組:

$array = array_collapse([[1, 2, 3], [4, 5, 6], [7, 8, 9]]);// [1, 2, 3, 4, 5, 6, 7, 8, 9]

array_divide()

該array_divide函數(shù)返回兩個數(shù)組,一個包含鍵,另一個包含給定數(shù)組的值:

[$keys, $values] = array_divide(['name' => 'Desk']);// $keys: ['name']// $values: ['Desk']

array_dot()

該array_dot函數(shù)將多維數(shù)組展平為單級數(shù)組,使用“點”符號表示深度:

$array = ['products' => ['desk' => ['price' => 100]]];$flattened = array_dot($array);// ['products.desk.price' => 100]

array_except()

該array_except函數(shù)從數(shù)組中刪除給定的鍵/值對:

$array = ['name' => 'Desk', 'price' => 100];$filtered = array_except($array, ['price']);// ['name' => 'Desk']

array_first()

該array_first函數(shù)返回通過給定真值測試的數(shù)組的第一個元素:

$array = [100, 200, 300];$first = array_first($array, function ($value, $key) {return $value >= 150; });// 200

默認值也可以作為第三個參數(shù)傳遞給方法。如果沒有值通過真值測試,則返回此值:

$first = array_first($array, $callback, $default);

array_flatten()

該array_flatten函數(shù)將多維數(shù)組展平為單個數(shù)組:

$array = ['name' => 'Joe', 'languages' => ['PHP', 'Ruby']];$flattened = array_flatten($array);// ['Joe', 'PHP', 'Ruby']

array_forget()

該array_forget函數(shù)使用“點”表示法從深度嵌套的數(shù)組中刪除給定的鍵/值對:

$array = ['products' => ['desk' => ['price' => 100]]];array_forget($array, 'products.desk');// ['products' => []]

array_get()

該array_get函數(shù)使用“點”表示法從深層嵌套數(shù)組中檢索值:

$array = ['products' => ['desk' => ['price' => 100]]];$price = array_get($array, 'products.desk.price');// 100

該array_get函數(shù)還接受默認值,如果找不到特定鍵,將返回該值:

$discount = array_get($array, 'products.desk.discount', 0);// 0

array_has()

該array_has函數(shù)使用“點”表示法檢查數(shù)組中是否存在給定項目或項目:

$array = ['product' => ['name' => 'Desk', 'price' => 100]];$contains = array_has($array, 'product.name');// true$contains = array_has($array, ['product.price', 'product.discount']);// false

array_last()

該array_last函數(shù)返回通過給定真值測試的數(shù)組的最后一個元素:

$array = [100, 200, 300, 110];$last = array_last($array, function ($value, $key) {return $value >= 150; });// 300

可以將默認值作為方法的第三個參數(shù)傳遞。如果沒有值通過真值測試,則返回此值:

$last = array_last($array, $callback, $default);

array_only()

該array_only函數(shù)僅返回給定數(shù)組中指定的鍵/值對:

$array = ['name' => 'Desk', 'price' => 100, 'orders' => 10];$slice = array_only($array, ['name', 'price']);// ['name' => 'Desk', 'price' => 100]

array_pluck()

該array_pluck函數(shù)從數(shù)組中檢索給定鍵的所有值:

$array = [['developer' => ['id' => 1, 'name' => 'Taylor']],['developer' => ['id' => 2, 'name' => 'Abigail']], ];$names = array_pluck($array, 'developer.name');// ['Taylor', 'Abigail']

您還可以指定希望如何鍵入結(jié)果列表:

$names = array_pluck($array, 'developer.name', 'developer.id');// [1 => 'Taylor', 2 => 'Abigail']

array_prepend()

該array_prepend函數(shù)將項目推送到數(shù)組的開頭:

$array = ['one', 'two', 'three', 'four'];$array = array_prepend($array, 'zero');// ['zero', 'one', 'two', 'three', 'four']

如果需要,您可以指定應該用于該值的鍵:

$array = ['price' => 100];$array = array_prepend($array, 'Desk', 'name');// ['name' => 'Desk', 'price' => 100]

array_pull()

該array_pull函數(shù)返回并從數(shù)組中刪除鍵/值對:

$array = ['name' => 'Desk', 'price' => 100];$name = array_pull($array, 'name');// $name: Desk// $array: ['price' => 100]

可以將默認值作為方法的第三個參數(shù)傳遞。如果密鑰不存在,將返回此值:

$value = array_pull($array, $key, $default);

array_random()

該array_random函數(shù)從數(shù)組中返回一個隨機值:

$array = [1, 2, 3, 4, 5];$random = array_random($array);// 4 - (retrieved randomly)

您還可以指定要作為可選的第二個參數(shù)返回的項目數(shù)。請注意,即使只需要一個項目,提供此參數(shù)也會返回一個數(shù)組:

$items = array_random($array, 2);// [2, 5] - (retrieved randomly)

array_set()

該array_set函數(shù)使用“點”表示法在深層嵌套數(shù)組中設置一個值:

$array = ['products' => ['desk' => ['price' => 100]]];array_set($array, 'products.desk.price', 200);// ['products' => ['desk' => ['price' => 200]]]

array_sort()

該array_sort函數(shù)按其值對數(shù)組進行排序:

$array = ['Desk', 'Table', 'Chair'];$sorted = array_sort($array);// ['Chair', 'Desk', 'Table']

您也可以通過給定Closure的結(jié)果對數(shù)組進行排序:

$array = [['name' => 'Desk'],['name' => 'Table'],['name' => 'Chair'], ];$sorted = array_values(array_sort($array, function ($value) {return $value['name']; }));/*[['name' => 'Chair'],['name' => 'Desk'],['name' => 'Table'],] */

array_sort_recursive()

該array_sort_recursive函數(shù)使用函數(shù)遞歸排序數(shù)組sort:

$array = [['Roman', 'Taylor', 'Li'],['PHP', 'Ruby', 'JavaScript'], ];$sorted = array_sort_recursive($array);/*[['Li', 'Roman', 'Taylor'],['JavaScript', 'PHP', 'Ruby'],] */

array_where()

該array_where函數(shù)使用給定的Closure過濾數(shù)組:

$array = [100, '200', 300, '400', 500];$filtered = array_where($array, function ($value, $key) {return is_string($value); });// [1 => '200', 3 => '400']

array_wrap()

該array_wrap函數(shù)將給定值包裝在一個數(shù)組中。如果給定值已經(jīng)是數(shù)組,則不會更改:

$string = 'Laravel';$array = array_wrap($string);// ['Laravel']

如果給定值為null,則返回一個空數(shù)組:

$nothing = null;$array = array_wrap($nothing);// []

data_fill()

該data_fill函數(shù)使用“點”表示法在嵌套數(shù)組或?qū)ο笾性O置缺失值:

$data = ['products' => ['desk' => ['price' => 100]]];data_fill($data, 'products.desk.price', 200);// ['products' => ['desk' => ['price' => 100]]]data_fill($data, 'products.desk.discount', 10);// ['products' => ['desk' => ['price' => 100, 'discount' => 10]]]

此函數(shù)還接受星號作為通配符,并相應地填充目標:

$data = ['products' => [['name' => 'Desk 1', 'price' => 100],['name' => 'Desk 2'],], ];data_fill($data, 'products.*.price', 200);/*['products' => [['name' => 'Desk 1', 'price' => 100],['name' => 'Desk 2', 'price' => 200],],] */

data_get()

該data_get函數(shù)使用“點”表示法從嵌套數(shù)組或?qū)ο笾袡z索值:

$data = ['products' => ['desk' => ['price' => 100]]];$price = data_get($data, 'products.desk.price');// 100

該data_get函數(shù)還接受默認值,如果找不到指定的鍵,將返回該值:

$discount = data_get($data, 'products.desk.discount', 0);// 0

data_set()

該data_set函數(shù)使用“點”表示法在嵌套數(shù)組或?qū)ο笾性O置值:

$data = ['products' => ['desk' => ['price' => 100]]];data_set($data, 'products.desk.price', 200);// ['products' => ['desk' => ['price' => 200]]]

此函數(shù)還接受通配符,并相應地在目標上設置值:

$data = ['products' => [['name' => 'Desk 1', 'price' => 100],['name' => 'Desk 2', 'price' => 150],], ];data_set($data, 'products.*.price', 200);/*['products' => [['name' => 'Desk 1', 'price' => 200],['name' => 'Desk 2', 'price' => 200],],] */

默認情況下,將覆蓋任何現(xiàn)有值。如果您只想設置一個值,如果它不存在,您可以false作為第三個參數(shù)傳遞:

$data = ['products' => ['desk' => ['price' => 100]]];data_set($data, 'products.desk.price', 200, false);// ['products' => ['desk' => ['price' => 100]]]

head()

該head函數(shù)返回給定數(shù)組中的第一個元素:

$array = [100, 200, 300];$first = head($array);// 100

last()

該last函數(shù)返回給定數(shù)組中的最后一個元素:

$array = [100, 200, 300];$last = last($array);// 300

all()

The?all?method returns the underlying array represented by the collection:

collect([1, 2, 3])->all();// [1, 2, 3]

average()

Alias for the?avg?method.

avg()

The?avg?method returns the?average value?of a given key:

$average = collect([['foo' => 10], ['foo' => 10], ['foo' => 20], ['foo' => 40]])->avg('foo');// 20$average = collect([1, 1, 2, 4])->avg();// 2

chunk()

The?chunk?method breaks the collection into multiple, smaller collections of a given size:

$collection = collect([1, 2, 3, 4, 5, 6, 7]);$chunks = $collection->chunk(4);$chunks->toArray();// [[1, 2, 3, 4], [5, 6, 7]]

This method is especially useful in?views?when working with a grid system such as?Bootstrap. Imagine you have a collection of?Eloquent?models you want to display in a grid:

@foreach ($products->chunk(3) as $chunk)<div class="row">@foreach ($chunk as $product)<div class="col-xs-4">{{ $product->name }}</div>@endforeach</div> @endforeach

collapse()

The?collapse?method collapses a collection of arrays into a single, flat collection:

$collection = collect([[1, 2, 3], [4, 5, 6], [7, 8, 9]]);$collapsed = $collection->collapse();$collapsed->all();// [1, 2, 3, 4, 5, 6, 7, 8, 9]

combine()

The?combine?method combines the keys of the collection with the values of another array or collection:

$collection = collect(['name', 'age']);$combined = $collection->combine(['George', 29]);$combined->all();// ['name' => 'George', 'age' => 29]

concat()

The?concat?method appends the given?array?or collection values onto the end of the collection:

$collection = collect(['John Doe']);$concatenated = $collection->concat(['Jane Doe'])->concat(['name' => 'Johnny Doe']);$concatenated->all();// ['John Doe', 'Jane Doe', 'Johnny Doe']

contains()

The?contains?method determines whether the collection contains a given item:

$collection = collect(['name' => 'Desk', 'price' => 100]);$collection->contains('Desk');// true$collection->contains('New York');// false

You may also pass a key / value pair to the?contains?method, which will determine if the given pair exists in the collection:

$collection = collect([['product' => 'Desk', 'price' => 200],['product' => 'Chair', 'price' => 100], ]);$collection->contains('product', 'Bookcase');// false

Finally, you may also pass a callback to the?contains?method to perform your own truth test:

$collection = collect([1, 2, 3, 4, 5]);$collection->contains(function ($value, $key) {return $value > 5; });// false

The?contains?method uses "loose" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value. Use the?containsStrict?method to filter using "strict" comparisons.

containsStrict()

This method has the same signature as the?contains?method; however, all values are compared using "strict" comparisons.

count()

The?count?method returns the total number of items in the collection:

$collection = collect([1, 2, 3, 4]);$collection->count();// 4

crossJoin()

The?crossJoin?method cross joins the collection's values among the given arrays or collections, returning a Cartesian product with all possible permutations:

$collection = collect([1, 2]);$matrix = $collection->crossJoin(['a', 'b']);$matrix->all();/*[[1, 'a'],[1, 'b'],[2, 'a'],[2, 'b'],] */$collection = collect([1, 2]);$matrix = $collection->crossJoin(['a', 'b'], ['I', 'II']);$matrix->all();/*[[1, 'a', 'I'],[1, 'a', 'II'],[1, 'b', 'I'],[1, 'b', 'II'],[2, 'a', 'I'],[2, 'a', 'II'],[2, 'b', 'I'],[2, 'b', 'II'],] */

dd()

The?dd?method dumps the collection's items and ends execution of the script:

$collection = collect(['John Doe', 'Jane Doe']);$collection->dd();/*Collection {#items: array:2 [0 => "John Doe"1 => "Jane Doe"]} */

If you do not want to stop executing the script, use the?dump?method instead.

diff()

The?diff?method compares the collection against another collection or a plain PHP?arraybased on its values. This method will return the values in the original collection that are not present in the given collection:

$collection = collect([1, 2, 3, 4, 5]);$diff = $collection->diff([2, 4, 6, 8]);$diff->all();// [1, 3, 5]

diffAssoc()

The?diffAssoc?method compares the collection against another collection or a plain PHP?array?based on its keys and values. This method will return the key / value pairs in the original collection that are not present in the given collection:

$collection = collect(['color' => 'orange','type' => 'fruit','remain' => 6 ]);$diff = $collection->diffAssoc(['color' => 'yellow','type' => 'fruit','remain' => 3,'used' => 6 ]);$diff->all();// ['color' => 'orange', 'remain' => 6]

diffKeys()

The?diffKeys?method compares the collection against another collection or a plain PHP?arraybased on its keys. This method will return the key / value pairs in the original collection that are not present in the given collection:

$collection = collect(['one' => 10,'two' => 20,'three' => 30,'four' => 40,'five' => 50, ]);$diff = $collection->diffKeys(['two' => 2,'four' => 4,'six' => 6,'eight' => 8, ]);$diff->all();// ['one' => 10, 'three' => 30, 'five' => 50]

dump()

The?dump?method dumps the collection's items:

$collection = collect(['John Doe', 'Jane Doe']);$collection->dump();/*Collection {#items: array:2 [0 => "John Doe"1 => "Jane Doe"]} */

If you want to stop executing the script after dumping the collection, use the?dd?method instead.

each()

The?each?method iterates over the items in the collection and passes each item to a callback:

$collection->each(function ($item, $key) {// });

If you would like to stop iterating through the items, you may return?false?from your callback:

$collection->each(function ($item, $key) {if (/* some condition */) {return false;} });

eachSpread()

The?eachSpread?method iterates over the collection's items, passing each nested item value into the given callback:

$collection = collect([['John Doe', 35], ['Jane Doe', 33]]);$collection->eachSpread(function ($name, $age) {// });

You may stop iterating through the items by returning?false?from the callback:

$collection->eachSpread(function ($name, $age) {return false; });

every()

The?every?method may be used to verify that all elements of a collection pass a given truth test:

collect([1, 2, 3, 4])->every(function ($value, $key) {return $value > 2; });// false

except()

The?except?method returns all items in the collection except for those with the specified keys:

$collection = collect(['product_id' => 1, 'price' => 100, 'discount' => false]);$filtered = $collection->except(['price', 'discount']);$filtered->all();// ['product_id' => 1]

For the inverse of?except, see the?only?method.

filter()

The?filter?method filters the collection using the given callback, keeping only those items that pass a given truth test:

$collection = collect([1, 2, 3, 4]);$filtered = $collection->filter(function ($value, $key) {return $value > 2; });$filtered->all();// [3, 4]

If no callback is supplied, all entries of the collection that are equivalent to?false?will be removed:

$collection = collect([1, 2, 3, null, false, '', 0, []]);$collection->filter()->all();// [1, 2, 3]

For the inverse of?filter, see the?reject?method.

first()

The?first?method returns the first element in the collection that passes a given truth test:

collect([1, 2, 3, 4])->first(function ($value, $key) {return $value > 2; });// 3

You may also call the?first?method with no arguments to get the first element in the collection. If the collection is empty,?null?is returned:

collect([1, 2, 3, 4])->first();// 1

firstWhere()

The?firstWhere?method returns the first element in the collection with the given key / value pair:

$collection = collect([['name' => 'Regena', 'age' => 12],['name' => 'Linda', 'age' => 14],['name' => 'Diego', 'age' => 23],['name' => 'Linda', 'age' => 84], ]);$collection->firstWhere('name', 'Linda');// ['name' => 'Linda', 'age' => 14]

You may also call the?firstWhere?method with an operator:

$collection->firstWhere('age', '>=', 18);// ['name' => 'Diego', 'age' => 23]

flatMap()

The?flatMap?method iterates through the collection and passes each value to the given callback. The callback is free to modify the item and return it, thus forming a new collection of modified items. Then, the array is flattened by a level:

$collection = collect([['name' => 'Sally'],['school' => 'Arkansas'],['age' => 28] ]);$flattened = $collection->flatMap(function ($values) {return array_map('strtoupper', $values); });$flattened->all();// ['name' => 'SALLY', 'school' => 'ARKANSAS', 'age' => '28'];

flatten()

The?flatten?method flattens a multi-dimensional collection into a single dimension:

$collection = collect(['name' => 'taylor', 'languages' => ['php', 'javascript']]);$flattened = $collection->flatten();$flattened->all();// ['taylor', 'php', 'javascript'];

You may optionally pass the function a "depth" argument:

$collection = collect(['Apple' => [['name' => 'iPhone 6S', 'brand' => 'Apple'],],'Samsung' => [['name' => 'Galaxy S7', 'brand' => 'Samsung']], ]);$products = $collection->flatten(1);$products->values()->all();/*[['name' => 'iPhone 6S', 'brand' => 'Apple'],['name' => 'Galaxy S7', 'brand' => 'Samsung'],] */

In this example, calling?flatten?without providing the depth would have also flattened the nested arrays, resulting in?['iPhone 6S',?'Apple',?'Galaxy S7',?'Samsung']. Providing a depth allows you to restrict the levels of nested arrays that will be flattened.

flip()

The?flip?method swaps the collection's keys with their corresponding values:

$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);$flipped = $collection->flip();$flipped->all();// ['taylor' => 'name', 'laravel' => 'framework']

forget()

The?forget?method removes an item from the collection by its key:

$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);$collection->forget('name');$collection->all();// ['framework' => 'laravel'] forget?does not return a new modified collection; it modifies the collection it is called on.

forPage()

The?forPage?method returns a new collection containing the items that would be present on a given page number. The method accepts the page number as its first argument and the number of items to show per page as its second argument:

$collection = collect([1, 2, 3, 4, 5, 6, 7, 8, 9]);$chunk = $collection->forPage(2, 3);$chunk->all();// [4, 5, 6]

get()

The?get?method returns the item at a given key. If the key does not exist,?null?is returned:

$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);$value = $collection->get('name');// taylor

You may optionally pass a default value as the second argument:

$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);$value = $collection->get('foo', 'default-value');// default-value

You may even pass a callback as the default value. The result of the callback will be returned if the specified key does not exist:

$collection->get('email', function () {return 'default-value'; });// default-value

groupBy()

The?groupBy?method groups the collection's items by a given key:

$collection = collect([['account_id' => 'account-x10', 'product' => 'Chair'],['account_id' => 'account-x10', 'product' => 'Bookcase'],['account_id' => 'account-x11', 'product' => 'Desk'], ]);$grouped = $collection->groupBy('account_id');$grouped->toArray();/*['account-x10' => [['account_id' => 'account-x10', 'product' => 'Chair'],['account_id' => 'account-x10', 'product' => 'Bookcase'],],'account-x11' => [['account_id' => 'account-x11', 'product' => 'Desk'],],] */

Instead of passing a string?key, you may pass a callback. The callback should return the value you wish to key the group by:

$grouped = $collection->groupBy(function ($item, $key) {return substr($item['account_id'], -3); });$grouped->toArray();/*['x10' => [['account_id' => 'account-x10', 'product' => 'Chair'],['account_id' => 'account-x10', 'product' => 'Bookcase'],],'x11' => [['account_id' => 'account-x11', 'product' => 'Desk'],],] */

Multiple grouping criteria may be passed as an array. Each array element will be applied to the corresponding level within a multi-dimensional array:

$data = new Collection([10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']], ]);$result = $data->groupBy(['skill',function ($item) {return $item['roles'];}, ], $preserveKeys = true);/* [1 => ['Role_1' => [10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],],'Role_2' => [20 => ['user' => 2, 'skill' => 1, 'roles' => ['Role_1', 'Role_2']],],'Role_3' => [10 => ['user' => 1, 'skill' => 1, 'roles' => ['Role_1', 'Role_3']],],],2 => ['Role_1' => [30 => ['user' => 3, 'skill' => 2, 'roles' => ['Role_1']],],'Role_2' => [40 => ['user' => 4, 'skill' => 2, 'roles' => ['Role_2']],],], ]; */

has()

The?has?method determines if a given key exists in the collection:

$collection = collect(['account_id' => 1, 'product' => 'Desk']);$collection->has('product');// true

implode()

The?implode?method joins the items in a collection. Its arguments depend on the type of items in the collection. If the collection contains arrays or objects, you should pass the key of the attributes you wish to join, and the "glue" string you wish to place between the values:

$collection = collect([['account_id' => 1, 'product' => 'Desk'],['account_id' => 2, 'product' => 'Chair'], ]);$collection->implode('product', ', ');// Desk, Chair

If the collection contains simple strings or numeric values, pass the "glue" as the only argument to the method:

collect([1, 2, 3, 4, 5])->implode('-');// '1-2-3-4-5'

intersect()

The?intersect?method removes any values from the original collection that are not present in the given?array?or collection. The resulting collection will preserve the original collection's keys:

$collection = collect(['Desk', 'Sofa', 'Chair']);$intersect = $collection->intersect(['Desk', 'Chair', 'Bookcase']);$intersect->all();// [0 => 'Desk', 2 => 'Chair']

intersectByKeys()

The?intersectByKeys?method removes any keys from the original collection that are not present in the given?array?or collection:

$collection = collect(['serial' => 'UX301', 'type' => 'screen', 'year' => 2009 ]);$intersect = $collection->intersectByKeys(['reference' => 'UX404', 'type' => 'tab', 'year' => 2011 ]);$intersect->all();// ['type' => 'screen', 'year' => 2009]

isEmpty()

The?isEmpty?method returns?true?if the collection is empty; otherwise,?false?is returned:

collect([])->isEmpty();// true

isNotEmpty()

The?isNotEmpty?method returns?true?if the collection is not empty; otherwise,?false?is returned:

collect([])->isNotEmpty();// false

keyBy()

The?keyBy?method keys the collection by the given key. If multiple items have the same key, only the last one will appear in the new collection:

$collection = collect([['product_id' => 'prod-100', 'name' => 'Desk'],['product_id' => 'prod-200', 'name' => 'Chair'], ]);$keyed = $collection->keyBy('product_id');$keyed->all();/*['prod-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],'prod-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],] */

You may also pass a callback to the method. The callback should return the value to key the collection by:

$keyed = $collection->keyBy(function ($item) {return strtoupper($item['product_id']); });$keyed->all();/*['PROD-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],'PROD-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],] */

keys()

The?keys?method returns all of the collection's keys:

$collection = collect(['prod-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],'prod-200' => ['product_id' => 'prod-200', 'name' => 'Chair'], ]);$keys = $collection->keys();$keys->all();// ['prod-100', 'prod-200']

last()

The?last?method returns the last element in the collection that passes a given truth test:

collect([1, 2, 3, 4])->last(function ($value, $key) {return $value < 3; });// 2

You may also call the?last?method with no arguments to get the last element in the collection. If the collection is empty,?null?is returned:

collect([1, 2, 3, 4])->last();// 4

macro()

The static?macro?method allows you to add methods to the?Collection?class at run time. Refer to the documentation on?extending collections?for more information.

make()

The static?make?method creates a new collection instance. See the?Creating Collectionssection.

map()

The?map?method iterates through the collection and passes each value to the given callback. The callback is free to modify the item and return it, thus forming a new collection of modified items:

$collection = collect([1, 2, 3, 4, 5]);$multiplied = $collection->map(function ($item, $key) {return $item * 2; });$multiplied->all();// [2, 4, 6, 8, 10] map?returns a new collection instance; it does not modify the collection it is called on. If you want to transform the original collection, use the?transform?method.

mapInto()

The?mapInto()?method iterates over the collection, creating a new instance of the given class by passing the value into the constructor:

class Currency {/*** Create a new currency instance.** @param string $code* @return void*/function __construct(string $code){$this->code = $code;} }$collection = collect(['USD', 'EUR', 'GBP']);$currencies = $collection->mapInto(Currency::class);$currencies->all();// [Currency('USD'), Currency('EUR'), Currency('GBP')]

mapSpread()

The?mapSpread?method iterates over the collection's items, passing each nested item value into the given callback. The callback is free to modify the item and return it, thus forming a new collection of modified items:

$collection = collect([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);$chunks = $collection->chunk(2);$sequence = $chunks->mapSpread(function ($odd, $even) {return $odd + $even; });$sequence->all();// [1, 5, 9, 13, 17]

mapToGroups()

The?mapToGroups?method groups the collection's items by the given callback. The callback should return an associative array containing a single key / value pair, thus forming a new collection of grouped values:

$collection = collect([['name' => 'John Doe','department' => 'Sales',],['name' => 'Jane Doe','department' => 'Sales',],['name' => 'Johnny Doe','department' => 'Marketing',] ]);$grouped = $collection->mapToGroups(function ($item, $key) {return [$item['department'] => $item['name']]; });$grouped->toArray();/*['Sales' => ['John Doe', 'Jane Doe'],'Marketing' => ['Johhny Doe'],] */$grouped->get('Sales')->all();// ['John Doe', 'Jane Doe']

mapWithKeys()

The?mapWithKeys?method iterates through the collection and passes each value to the given callback. The callback should return an associative array containing a single key / value pair:

$collection = collect([['name' => 'John','department' => 'Sales','email' => 'john@example.com'],['name' => 'Jane','department' => 'Marketing','email' => 'jane@example.com'] ]);$keyed = $collection->mapWithKeys(function ($item) {return [$item['email'] => $item['name']]; });$keyed->all();/*['john@example.com' => 'John','jane@example.com' => 'Jane',] */

max()

The?max?method returns the maximum value of a given key:

$max = collect([['foo' => 10], ['foo' => 20]])->max('foo');// 20$max = collect([1, 2, 3, 4, 5])->max();// 5

median()

The?median?method returns the?median value?of a given key:

$median = collect([['foo' => 10], ['foo' => 10], ['foo' => 20], ['foo' => 40]])->median('foo');// 15$median = collect([1, 1, 2, 4])->median();// 1.5

merge()

The?merge?method merges the given array or collection with the original collection. If a string key in the given items matches a string key in the original collection, the given items's value will overwrite the value in the original collection:

$collection = collect(['product_id' => 1, 'price' => 100]);$merged = $collection->merge(['price' => 200, 'discount' => false]);$merged->all();// ['product_id' => 1, 'price' => 200, 'discount' => false]

If the given items's keys are numeric, the values will be appended to the end of the collection:

$collection = collect(['Desk', 'Chair']);$merged = $collection->merge(['Bookcase', 'Door']);$merged->all();// ['Desk', 'Chair', 'Bookcase', 'Door']

min()

The?min?method returns the minimum value of a given key:

$min = collect([['foo' => 10], ['foo' => 20]])->min('foo');// 10$min = collect([1, 2, 3, 4, 5])->min();// 1

mode()

The?mode?method returns the?mode value?of a given key:

$mode = collect([['foo' => 10], ['foo' => 10], ['foo' => 20], ['foo' => 40]])->mode('foo');// [10]$mode = collect([1, 1, 2, 4])->mode();// [1]

nth()

The?nth?method creates a new collection consisting of every n-th element:

$collection = collect(['a', 'b', 'c', 'd', 'e', 'f']);$collection->nth(4);// ['a', 'e']

You may optionally pass an offset as the second argument:

$collection->nth(4, 1);// ['b', 'f']

only()

The?only?method returns the items in the collection with the specified keys:

$collection = collect(['product_id' => 1, 'name' => 'Desk', 'price' => 100, 'discount' => false]);$filtered = $collection->only(['product_id', 'name']);$filtered->all();// ['product_id' => 1, 'name' => 'Desk']

For the inverse of?only, see the?except?method.

pad()

The?pad?method will fill the array with the given value until the array reaches the specified size. This method behaves like the?array_pad?PHP function.

To pad to the left, you should specify a negative size. No padding will take place if the absolute value of the given size is less than or equal to the length of the array:

$collection = collect(['A', 'B', 'C']);$filtered = $collection->pad(5, 0);$filtered->all();// ['A', 'B', 'C', 0, 0]$filtered = $collection->pad(-5, 0);$filtered->all();// [0, 0, 'A', 'B', 'C']

partition()

The?partition?method may be combined with the?list?PHP function to separate elements that pass a given truth test from those that do not:

$collection = collect([1, 2, 3, 4, 5, 6]);list($underThree, $aboveThree) = $collection->partition(function ($i) {return $i < 3; });$underThree->all();// [1, 2]$aboveThree->all();// [3, 4, 5, 6]

pipe()

The?pipe?method passes the collection to the given callback and returns the result:

$collection = collect([1, 2, 3]);$piped = $collection->pipe(function ($collection) {return $collection->sum(); });// 6

pluck()

The?pluck?method retrieves all of the values for a given key:

$collection = collect([['product_id' => 'prod-100', 'name' => 'Desk'],['product_id' => 'prod-200', 'name' => 'Chair'], ]);$plucked = $collection->pluck('name');$plucked->all();// ['Desk', 'Chair']

You may also specify how you wish the resulting collection to be keyed:

$plucked = $collection->pluck('name', 'product_id');$plucked->all();// ['prod-100' => 'Desk', 'prod-200' => 'Chair']

If duplicate keys exist, the last matching element will be inserted into the plucked collection:

$collection = collect([['brand' => 'Tesla', 'color' => 'red'],['brand' => 'Pagani', 'color' => 'white'],['brand' => 'Tesla', 'color' => 'black'],['brand' => 'Pagani', 'color' => 'orange'], ]);$plucked = $collection->pluck('color', 'brand');$plucked->all();// ['Tesla' => 'black', 'Pagani' => 'orange']

pop()

The?pop?method removes and returns the last item from the collection:

$collection = collect([1, 2, 3, 4, 5]);$collection->pop();// 5$collection->all();// [1, 2, 3, 4]

prepend()

The?prepend?method adds an item to the beginning of the collection:

$collection = collect([1, 2, 3, 4, 5]);$collection->prepend(0);$collection->all();// [0, 1, 2, 3, 4, 5]

You may also pass a second argument to set the key of the prepended item:

$collection = collect(['one' => 1, 'two' => 2]);$collection->prepend(0, 'zero');$collection->all();// ['zero' => 0, 'one' => 1, 'two' => 2]

pull()

The?pull?method removes and returns an item from the collection by its key:

$collection = collect(['product_id' => 'prod-100', 'name' => 'Desk']);$collection->pull('name');// 'Desk'$collection->all();// ['product_id' => 'prod-100']

push()

The?push?method appends an item to the end of the collection:

$collection = collect([1, 2, 3, 4]);$collection->push(5);$collection->all();// [1, 2, 3, 4, 5]

put()

The?put?method sets the given key and value in the collection:

$collection = collect(['product_id' => 1, 'name' => 'Desk']);$collection->put('price', 100);$collection->all();// ['product_id' => 1, 'name' => 'Desk', 'price' => 100]

random()

The?random?method returns a random item from the collection:

$collection = collect([1, 2, 3, 4, 5]);$collection->random();// 4 - (retrieved randomly)

You may optionally pass an integer to?random?to specify how many items you would like to randomly retrieve. A collection of items is always returned when explicitly passing the number of items you wish to receive:

$random = $collection->random(3);$random->all();// [2, 4, 5] - (retrieved randomly)

If the Collection has fewer items than requested, the method will throw an?InvalidArgumentException.

reduce()

The?reduce?method reduces the collection to a single value, passing the result of each iteration into the subsequent iteration:

$collection = collect([1, 2, 3]);$total = $collection->reduce(function ($carry, $item) {return $carry + $item; });// 6

The value for?$carry?on the first iteration is?null; however, you may specify its initial value by passing a second argument to?reduce:

$collection->reduce(function ($carry, $item) {return $carry + $item; }, 4);// 10

reject()

The?reject?method filters the collection using the given callback. The callback should return?true?if the item should be removed from the resulting collection:

$collection = collect([1, 2, 3, 4]);$filtered = $collection->reject(function ($value, $key) {return $value > 2; });$filtered->all();// [1, 2]

For the inverse of the?reject?method, see the?filter?method.

reverse()

The?reverse?method reverses the order of the collection's items, preserving the original keys:

$collection = collect(['a', 'b', 'c', 'd', 'e']);$reversed = $collection->reverse();$reversed->all();/*[4 => 'e',3 => 'd',2 => 'c',1 => 'b',0 => 'a',] */

search()

The?search?method searches the collection for the given value and returns its key if found. If the item is not found,?false?is returned.

$collection = collect([2, 4, 6, 8]);$collection->search(4);// 1

The search is done using a "loose" comparison, meaning a string with an integer value will be considered equal to an integer of the same value. To use "strict" comparison, pass?true?as the second argument to the method:

$collection->search('4', true);// false

Alternatively, you may pass in your own callback to search for the first item that passes your truth test:

$collection->search(function ($item, $key) {return $item > 5; });// 2

shift()

The?shift?method removes and returns the first item from the collection:

$collection = collect([1, 2, 3, 4, 5]);$collection->shift();// 1$collection->all();// [2, 3, 4, 5]

shuffle()

The?shuffle?method randomly shuffles the items in the collection:

$collection = collect([1, 2, 3, 4, 5]);$shuffled = $collection->shuffle();$shuffled->all();// [3, 2, 5, 1, 4] - (generated randomly)

slice()

The?slice?method returns a slice of the collection starting at the given index:

$collection = collect([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);$slice = $collection->slice(4);$slice->all();// [5, 6, 7, 8, 9, 10]

If you would like to limit the size of the returned slice, pass the desired size as the second argument to the method:

$slice = $collection->slice(4, 2);$slice->all();// [5, 6]

The returned slice will preserve keys by default. If you do not wish to preserve the original keys, you can use the?values?method to reindex them.

sort()

The?sort?method sorts the collection. The sorted collection keeps the original array keys, so in this example we'll use the?values?method to reset the keys to consecutively numbered indexes:

$collection = collect([5, 3, 1, 2, 4]);$sorted = $collection->sort();$sorted->values()->all();// [1, 2, 3, 4, 5]

If your sorting needs are more advanced, you may pass a callback to?sort?with your own algorithm. Refer to the PHP documentation on?uasort, which is what the collection's?sortmethod calls under the hood.

sortBy?and?sortByDesc?methods.

sortBy()

The?sortBy?method sorts the collection by the given key. The sorted collection keeps the original array keys, so in this example we'll use the?values?method to reset the keys to consecutively numbered indexes:

$collection = collect([['name' => 'Desk', 'price' => 200],['name' => 'Chair', 'price' => 100],['name' => 'Bookcase', 'price' => 150], ]);$sorted = $collection->sortBy('price');$sorted->values()->all();/*[['name' => 'Chair', 'price' => 100],['name' => 'Bookcase', 'price' => 150],['name' => 'Desk', 'price' => 200],] */

You can also pass your own callback to determine how to sort the collection values:

$collection = collect([['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],['name' => 'Chair', 'colors' => ['Black']],['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']], ]);$sorted = $collection->sortBy(function ($product, $key) {return count($product['colors']); });$sorted->values()->all();/*[['name' => 'Chair', 'colors' => ['Black']],['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']],] */

sortByDesc()

This method has the same signature as the?sortBy?method, but will sort the collection in the opposite order.

sortKeys()

The?sortKeys?method sorts the collection by the keys of the underlying associative array:

$collection = collect(['id' => 22345,'first' => 'John','last' => 'Doe', ]);$sorted = $collection->sortKeys();$sorted->all();/*['first' => 'John','id' => 22345,'last' => 'Doe',] */

sortKeysDesc()

This method has the same signature as the?sortKeys?method, but will sort the collection in the opposite order.

splice()

The?splice?method removes and returns a slice of items starting at the specified index:

$collection = collect([1, 2, 3, 4, 5]);$chunk = $collection->splice(2);$chunk->all();// [3, 4, 5]$collection->all();// [1, 2]

You may pass a second argument to limit the size of the resulting chunk:

$collection = collect([1, 2, 3, 4, 5]);$chunk = $collection->splice(2, 1);$chunk->all();// [3]$collection->all();// [1, 2, 4, 5]

In addition, you can pass a third argument containing the new items to replace the items removed from the collection:

$collection = collect([1, 2, 3, 4, 5]);$chunk = $collection->splice(2, 1, [10, 11]);$chunk->all();// [3]$collection->all();// [1, 2, 10, 11, 4, 5]

split()

The?split?method breaks a collection into the given number of groups:

$collection = collect([1, 2, 3, 4, 5]);$groups = $collection->split(3);$groups->toArray();// [[1, 2], [3, 4], [5]]

sum()

The?sum?method returns the sum of all items in the collection:

collect([1, 2, 3, 4, 5])->sum();// 15

If the collection contains nested arrays or objects, you should pass a key to use for determining which values to sum:

$collection = collect([['name' => 'JavaScript: The Good Parts', 'pages' => 176],['name' => 'JavaScript: The Definitive Guide', 'pages' => 1096], ]);$collection->sum('pages');// 1272

In addition, you may pass your own callback to determine which values of the collection to sum:

$collection = collect([['name' => 'Chair', 'colors' => ['Black']],['name' => 'Desk', 'colors' => ['Black', 'Mahogany']],['name' => 'Bookcase', 'colors' => ['Red', 'Beige', 'Brown']], ]);$collection->sum(function ($product) {return count($product['colors']); });// 6

take()

The?take?method returns a new collection with the specified number of items:

$collection = collect([0, 1, 2, 3, 4, 5]);$chunk = $collection->take(3);$chunk->all();// [0, 1, 2]

You may also pass a negative integer to take the specified amount of items from the end of the collection:

$collection = collect([0, 1, 2, 3, 4, 5]);$chunk = $collection->take(-2);$chunk->all();// [4, 5]

tap()

The?tap?method passes the collection to the given callback, allowing you to "tap" into the collection at a specific point and do something with the items while not affecting the collection itself:

collect([2, 4, 3, 1, 5])->sort()->tap(function ($collection) {Log::debug('Values after sorting', $collection->values()->toArray());})->shift();// 1

times()

The static?times?method creates a new collection by invoking the callback a given amount of times:

$collection = Collection::times(10, function ($number) {return $number * 9; });$collection->all();// [9, 18, 27, 36, 45, 54, 63, 72, 81, 90]

This method can be useful when combined with factories to create?Eloquent?models:

$categories = Collection::times(3, function ($number) {return factory(Category::class)->create(['name' => 'Category #'.$number]); });$categories->all();/*[['id' => 1, 'name' => 'Category #1'],['id' => 2, 'name' => 'Category #2'],['id' => 3, 'name' => 'Category #3'],] */

toArray()

The?toArray?method converts the collection into a plain PHP?array. If the collection's values are?Eloquent?models, the models will also be converted to arrays:

$collection = collect(['name' => 'Desk', 'price' => 200]);$collection->toArray();/*[['name' => 'Desk', 'price' => 200],] */ toArray?also converts all of the collection's nested objects to an array. If you want to get the raw underlying array, use the?all?method instead.

toJson()

The?toJson?method converts the collection into a JSON serialized string:

$collection = collect(['name' => 'Desk', 'price' => 200]);$collection->toJson();// '{"name":"Desk", "price":200}'

transform()

The?transform?method iterates over the collection and calls the given callback with each item in the collection. The items in the collection will be replaced by the values returned by the callback:

$collection = collect([1, 2, 3, 4, 5]);$collection->transform(function ($item, $key) {return $item * 2; });$collection->all();// [2, 4, 6, 8, 10] transform?modifies the collection itself. If you wish to create a new collection instead, use the?map?method.

union()

The?union?method adds the given array to the collection. If the given array contains keys that are already in the original collection, the original collection's values will be preferred:

$collection = collect([1 => ['a'], 2 => ['b']]);$union = $collection->union([3 => ['c'], 1 => ['b']]);$union->all();// [1 => ['a'], 2 => ['b'], 3 => ['c']]

unique()

The?unique?method returns all of the unique items in the collection. The returned collection keeps the original array keys, so in this example we'll use the?values?method to reset the keys to consecutively numbered indexes:

$collection = collect([1, 1, 2, 2, 3, 4, 2]);$unique = $collection->unique();$unique->values()->all();// [1, 2, 3, 4]

When dealing with nested arrays or objects, you may specify the key used to determine uniqueness:

$collection = collect([['name' => 'iPhone 6', 'brand' => 'Apple', 'type' => 'phone'],['name' => 'iPhone 5', 'brand' => 'Apple', 'type' => 'phone'],['name' => 'Apple Watch', 'brand' => 'Apple', 'type' => 'watch'],['name' => 'Galaxy S6', 'brand' => 'Samsung', 'type' => 'phone'],['name' => 'Galaxy Gear', 'brand' => 'Samsung', 'type' => 'watch'], ]);$unique = $collection->unique('brand');$unique->values()->all();/*[['name' => 'iPhone 6', 'brand' => 'Apple', 'type' => 'phone'],['name' => 'Galaxy S6', 'brand' => 'Samsung', 'type' => 'phone'],] */

You may also pass your own callback to determine item uniqueness:

$unique = $collection->unique(function ($item) {return $item['brand'].$item['type']; });$unique->values()->all();/*[['name' => 'iPhone 6', 'brand' => 'Apple', 'type' => 'phone'],['name' => 'Apple Watch', 'brand' => 'Apple', 'type' => 'watch'],['name' => 'Galaxy S6', 'brand' => 'Samsung', 'type' => 'phone'],['name' => 'Galaxy Gear', 'brand' => 'Samsung', 'type' => 'watch'],] */

The?unique?method uses "loose" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value. Use the?uniqueStrict?method to filter using "strict" comparisons.

uniqueStrict()

This method has the same signature as the?unique?method; however, all values are compared using "strict" comparisons.

unless()

The?unless?method will execute the given callback unless the first argument given to the method evaluates to?true:

$collection = collect([1, 2, 3]);$collection->unless(true, function ($collection) {return $collection->push(4); });$collection->unless(false, function ($collection) {return $collection->push(5); });$collection->all();// [1, 2, 3, 5]

For the inverse of?unless, see the?when?method.

unwrap()

The static?unwrap?method returns the collection's underlying items from the given value when applicable:

Collection::unwrap(collect('John Doe'));// ['John Doe']Collection::unwrap(['John Doe']);// ['John Doe']Collection::unwrap('John Doe');// 'John Doe'

values()

The?values?method returns a new collection with the keys reset to consecutive integers:

$collection = collect([10 => ['product' => 'Desk', 'price' => 200],11 => ['product' => 'Desk', 'price' => 200] ]);$values = $collection->values();$values->all();/*[0 => ['product' => 'Desk', 'price' => 200],1 => ['product' => 'Desk', 'price' => 200],] */

when()

The?when?method will execute the given callback when the first argument given to the method evaluates to?true:

$collection = collect([1, 2, 3]);$collection->when(true, function ($collection) {return $collection->push(4); });$collection->when(false, function ($collection) {return $collection->push(5); });$collection->all();// [1, 2, 3, 4]

For the inverse of?when, see the?unless?method.

where()

The?where?method filters the collection by a given key / value pair:

$collection = collect([['product' => 'Desk', 'price' => 200],['product' => 'Chair', 'price' => 100],['product' => 'Bookcase', 'price' => 150],['product' => 'Door', 'price' => 100], ]);$filtered = $collection->where('price', 100);$filtered->all();/*[['product' => 'Chair', 'price' => 100],['product' => 'Door', 'price' => 100],] */

The?where?method uses "loose" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value. Use the?whereStrict?method to filter using "strict" comparisons.

whereStrict()

This method has the same signature as the?where?method; however, all values are compared using "strict" comparisons.

whereIn()

The?whereIn?method filters the collection by a given key / value contained within the given array:

$collection = collect([['product' => 'Desk', 'price' => 200],['product' => 'Chair', 'price' => 100],['product' => 'Bookcase', 'price' => 150],['product' => 'Door', 'price' => 100], ]);$filtered = $collection->whereIn('price', [150, 200]);$filtered->all();/*[['product' => 'Bookcase', 'price' => 150],['product' => 'Desk', 'price' => 200],] */

The?whereIn?method uses "loose" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value. Use the?whereInStrict?method to filter using "strict" comparisons.

whereInStrict()

This method has the same signature as the?whereIn?method; however, all values are compared using "strict" comparisons.

whereInstanceOf()

The?whereInstanceOf?method filters the collection by a given class type:

$collection = collect([new User,new User,new Post, ]);return $collection->whereInstanceOf(User::class);

whereNotIn()

The?whereNotIn?method filters the collection by a given key / value not contained within the given array:

$collection = collect([['product' => 'Desk', 'price' => 200],['product' => 'Chair', 'price' => 100],['product' => 'Bookcase', 'price' => 150],['product' => 'Door', 'price' => 100], ]);$filtered = $collection->whereNotIn('price', [150, 200]);$filtered->all();/*[['product' => 'Chair', 'price' => 100],['product' => 'Door', 'price' => 100],] */

The?whereNotIn?method uses "loose" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value. Use the?whereNotInStrict?method to filter using "strict" comparisons.

whereNotInStrict()

This method has the same signature as the?whereNotIn?method; however, all values are compared using "strict" comparisons.

wrap()

The static?wrap?method wraps the given value in a collection when applicable:

$collection = Collection::wrap('John Doe');$collection->all();// ['John Doe']$collection = Collection::wrap(['John Doe']);$collection->all();// ['John Doe']$collection = Collection::wrap(collect('John Doe'));$collection->all();// ['John Doe']

zip()

The?zip?method merges together the values of the given array with the values of the original collection at the corresponding index:

$collection = collect(['Chair', 'Desk']);$zipped = $collection->zip([100, 200]);$zipped->all();// [['Chair', 100], ['Desk', 200]]

Higher Order Messages

Collections also provide support for "higher order messages", which are short-cuts for performing common actions on collections. The collection methods that provide higher order messages are:?average,?avg,?contains,?each,?every,?filter,?first,?flatMap,?groupBy,?keyBy,?map,?max,?min,?partition,?reject,?sortBy,?sortByDesc,?sum, and?unique.

Each higher order message can be accessed as a dynamic property on a collection instance. For instance, let's use the?each?higher order message to call a method on each object within a collection:

$users = User::where('votes', '>', 500)->get();$users->each->markAsVip();

Likewise, we can use the?sum?higher order message to gather the total number of "votes" for a collection of users:

$users = User::where('group', 'Development')->get();return $users->sum->votes;

orm get()查詢數(shù)據(jù)集合轉(zhuǎn)為數(shù)組

$data = DB::table('test')->get()->map(function ($value) { return (array)$value; })->toArray();

總結(jié)

以上是生活随笔為你收集整理的Laravel Lumen 数组操作的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。

福利视频导航网址 | 狠狠躁夜夜躁人人爽视频 | 狠狠夜夜| 亚洲传媒在线 | 精品国产aⅴ一区二区三区 在线直播av | 国产精品成人在线 | 五月婷婷综合激情 | 国产精品白丝jk白祙 | 亚洲午夜精品久久久 | 亚洲精品国产日韩 | 97精品国自产拍在线观看 | 香蕉看片| 久久伊人八月婷婷综合激情 | 99久久久国产精品美女 | 欧美人牲 | 91麻豆国产福利在线观看 | 91福利视频久久久久 | 99久热在线精品视频成人一区 | 欧美伊人网 | 99久久精品免费看国产一区二区三区 | 日韩精品欧美专区 | 99 精品 在线 | 日韩在线免费 | 久久香蕉影视 | 91在线视频免费播放 | 国产视频欧美视频 | 999精品| 五月婷婷在线播放 | 97看片网| 国产视频久久 | 97在线影院 | 色欧美88888久久久久久影院 | 精品国产一区二区三区久久 | 手机av电影在线 | 国产在线一区观看 | 日本精品久久久久久 | 狠狠激情中文字幕 | 亚洲国内精品在线 | 黄色亚洲大片免费在线观看 | 911在线 | 国内久久久久久 | 蜜桃视频在线观看一区 | 四虎在线视频 | 亚洲欧美经典 | 黄色av一级片 | 免费三级av | 国产二区视频在线观看 | 亚洲国产字幕 | a黄在线观看 | 亚州av成人| 精品国产免费观看 | av青草| 国产高清第一页 | 久久国产精品电影 | 国产手机精品视频 | 91大神一区二区三区 | 国产精品女同一区二区三区久久夜 | 一级黄色免费 | 国产麻豆视频免费观看 | 国产小视频免费观看 | 久久综合爱 | 四虎国产精品免费观看视频优播 | 中文字幕在线成人 | 国内精品久久久久久久久久清纯 | 国产精品一区二区麻豆 | 在线观看成年人 | 久草在线视频在线 | 国产精品伦一区二区三区视频 | 成人a在线观看高清电影 | 又紧又大又爽精品一区二区 | 美女免费电影 | 色网站中文字幕 | 黄色av免费在线 | 狂野欧美激情性xxxx | 亚洲最大av网 | 成年人app网址 | 日韩欧美在线观看一区二区 | 91av大全 | 99色免费视频| 国产午夜精品福利视频 | 国模精品在线 | 国产精品片 | 免费av大全 | 91人人澡人人爽 | 日韩av电影一区 | 在线视频黄 | 亚洲另类视频在线观看 | 欧洲一区二区三区精品 | 五月婷婷综合激情网 | 国产午夜精品免费一区二区三区视频 | 96av麻豆蜜桃一区二区 | 成人亚洲精品久久久久 | 成人免费观看视频网站 | 日韩成人免费电影 | 久久一二三四 | 人人插人人| 国产人成一区二区三区影院 | 国产 日韩 在线 亚洲 字幕 中文 | 超碰日韩在线 | 成人免费观看大片 | 97视频在线免费观看 | 婷婷色在线视频 | 日韩免费播放 | 中文字幕不卡在线88 | 日本老少交 | 国产人成精品一区二区三 | 成人资源在线 | 久久国产a | 18做爰免费视频网站 | 一区二区三区免费在线观看视频 | 色资源在线观看 | 激情综合网色播五月 | 91试看 | 中文字幕人成乱码在线观看 | 国产色视频一区二区三区qq号 | 激情视频一区二区 | 国产精品久久久久久久久久久久久久 | 国产精品高清一区二区三区 | 久久精品视频观看 | av大片免费在线观看 | 久久久综合九色合综国产精品 | 久久国产三级 | 九九久久免费视频 | 国产精品av免费在线观看 | 亚洲aⅴ在线观看 | 九九99靖品 | 99久久精品免费看国产一区二区三区 | 欧美日韩在线观看一区二区 | 色wwwww| 国产99久久久精品视频 | 人人干干人人 | 中文字幕成人 | 久久精品一区二区三区中文字幕 | 国产成人免费在线观看 | 国产精品99免费看 | 视频成人| 久久久国产精品人人片99精片欧美一 | 久久精品久久99 | 久久试看| 国产精品系列在线 | 天天操夜夜操天天射 | 97超视频免费观看 | 中文字幕在线看片 | 三级av网 | 伊人资源视频在线 | 国产人成在线视频 | 亚洲成av人片在线观看香蕉 | 日韩在线精品一区 | 亚洲视频免费 | 91中文在线观看 | 九九免费在线视频 | 91亚洲网站 | 91高清视频在线 | 久久精品国亚洲 | 国产69精品久久久久9999apgf | 亚洲精品www久久久久久 | 欧美一级片免费在线观看 | 91麻豆精品国产91久久久更新时间 | 97视频网站 | www国产在线 | 四虎成人精品在永久免费 | 欧美日韩xx | 日韩久久久久久久 | 久久综合久久鬼 | 一区二区三区免费在线观看视频 | 在线观看岛国 | 成年人三级网站 | 国产精品观看 | 黄色国产区 | 一本一本久久aa综合精品 | 久久久久久黄色 | 午夜精品久久久久久久99 | 成人免费网站视频 | 亚州精品在线视频 | 国产亚洲精品久久网站 | 丁香六月天 | 国产精品一区二区三区视频免费 | 综合久久网 | 日韩欧美在线综合网 | 国产精品一区二区免费在线观看 | 久久桃花网 | 久久成视频 | 不卡av在线 | 99久热 | 精品一区二三区 | 成人全视频免费观看在线看 | 成人h动漫精品一区二 | 亚洲免费不卡 | 久久精品精品电影网 | 久久精品在线视频 | 色综合天天综合 | 少妇性bbb搡bbb爽爽爽欧美 | 国产在线播放一区二区三区 | 亚洲成av人片在线观看 | 人人爽人人做 | 亚洲无吗av| 美女网站视频免费黄 | 精品伊人久久久 | 天天色播 | av福利在线| 伊人天堂av | 999久久国精品免费观看网站 | 亚洲成人av电影 | 日日夜夜操av | 91喷水| 日韩电影中文字幕 | av超碰在线 | 亚洲最新av | 在线观看精品一区 | 国产不卡精品视频 | 中文字幕中文 | 青青河边草免费观看 | 亚洲网站在线 | www在线免费观看 | 久久成年人视频 | 日韩精品久久中文字幕 | 免费看国产a | 国产精品久久久久永久免费 | 狠狠色丁香婷婷综合 | 六月丁香婷婷网 | 国产视频资源在线观看 | 婷婷精品在线视频 | 青青草国产成人99久久 | 一区在线观看视频 | 久久成人国产精品一区二区 | 玖玖综合网| 亚洲一区二区精品3399 | 在线观看的av | 狠狠躁夜夜躁人人爽超碰97香蕉 | 国产精品成| 久久久久久久网 | 五月婷网站| 国产xxxxx在线观看 | 天天综合色天天综合 | 亚洲精欧美一区二区精品 | 午夜精品福利一区二区三区蜜桃 | 日韩欧美一区二区三区黑寡妇 | 久久激五月天综合精品 | 日韩三级视频 | 99欧美视频 | 日韩理论影院 | 亚洲人成综合 | 亚洲综合色丁香婷婷六月图片 | 91av原创| 国产精品嫩草影院123 | 波多野结衣视频一区二区 | 午夜美女福利直播 | 成+人+色综合 | 成片免费观看视频 | 亚洲老妇xxxxxx| 五月婷婷综合在线视频 | 日日夜色 | 高清不卡一区二区在线 | 五月婷激情 | 天天超碰 | 午夜精品一区二区三区免费 | 91麻豆精品国产91久久久久久久久 | 在线看一区二区 | 在线电影av | 不卡av电影在线观看 | 免费日韩一区二区三区 | 国产精品99久久久久人中文网介绍 | 成x99人av在线www | 婷婷视频在线观看 | 2024av| 91传媒激情理伦片 | 精品不卡视频 | 九九色网| 中文av一区二区 | 国产一级视频在线免费观看 | 免费看色网站 | 欧美99久久 | 精品一区二区在线播放 | 国产99在线免费 | 国内精品视频免费 | 欧美日本啪啪无遮挡网站 | 国产一级在线观看 | 在线观看成人av | www.99在线观看 | 摸阴视频 | 99精品久久99久久久久 | 日本久久久久久久久久久 | 国产亚洲精品久久久网站好莱 | 一区二区精品在线观看 | 亚洲国产经典视频 | 手机av观看 | 日韩三级视频在线看 | 国产在线国偷精品产拍 | 少妇性bbb搡bbb爽爽爽欧美 | 五月天久久综合网 | 欧美精品免费在线 | 欧美日韩在线观看一区二区三区 | 久久黄网站 | 国产精品一级视频 | 成人久久网 | 午夜视频在线网站 | 久要激情网 | 中文字幕中文字幕中文字幕 | 国产高清av免费在线观看 | 在线黄色av电影 | 日韩欧美精品在线 | 91精品一区在线观看 | 国产黄在线 | 亚洲日本一区二区在线 | 精品极品在线 | 九九热免费在线视频 | 成人在线播放免费观看 | 97超碰在线人人 | 久久久久久久看片 | av日韩在线网站 | 最近中文字幕视频网 | 久久中文字幕视频 | av免费在线播放 | 国产精品原创av片国产免费 | 91人人揉日日捏人人看 | 成人福利在线观看 | 国产精品av免费在线观看 | 激情视频在线高清看 | 粉嫩av一区二区三区入口 | 99热这里只有精品8 久久综合毛片 | 亚洲欧美视频网站 | 日韩专区在线播放 | 狠狠网站 | 免费三级骚 | 久久免费公开视频 | 日韩精品极品视频 | 青青草视频精品 | 夜夜操狠狠干 | 国产视频欧美视频 | 深爱激情av| 精品一区在线 | 99热九九这里只有精品10 | 国产高清久久久 | 日韩性久久 | 亚洲免费成人 | 国产精品女人久久久久久 | 国产免费叼嘿网站免费 | 久久综合精品国产一区二区三区 | 中文字幕资源网在线观看 | 日日爽天天爽 | 欧美一级片免费 | 日韩丝袜视频 | 日韩一区二区三区高清免费看看 | 久久综合九色综合久99 | 国产在线播放不卡 | 91在线观看视频 | 国产成人一区二区精品非洲 | 亚洲午夜久久久久 | 国产成人久久精品77777综合 | 成人禁用看黄a在线 | 天天超碰 | 热re99久久精品国产66热 | 精品国产aⅴ一区二区三区 在线直播av | 一区二区观看 | 国产成人精品av在线观 | 国产永久免费观看 | 九草视频在线 | 91资源在线| 久久国产精品影片 | 五月婷视频 | 婷婷在线网站 | 五月激情六月丁香 | 五月婷婷丁香色 | 免费成人av电影 | 91精品国产欧美一区二区 | 国产人成看黄久久久久久久久 | 超碰97人 | 日本精品久久久久 | 精品国产乱码久久久久久三级人 | 色多多在线观看 | 欧美三级高清 | 国产超碰97 | 亚洲国产中文字幕在线观看 | 91毛片视频| 最近中文字幕完整高清 | 97精品久久人人爽人人爽 | 99久久精品国产一区二区成人 | 大荫蒂欧美视频另类xxxx | 久久这里只有精品首页 | 黄色av观看| 国产精品视频久久久 | 人人草人| 天天天干天天射天天天操 | 国产婷婷精品av在线 | 夜夜夜草| www.人人干| 国产精品视频不卡 | 国内视频| 日韩国产高清在线 | 97成人精品视频在线播放 | 黄色91免费观看 | 欧美va天堂va视频va在线 | 波多野结衣电影一区二区三区 | 成人三级av| 国产免费专区 | 狠狠操天天干 | 亚洲激情视频在线 | 天天拍天天草 | 国产乱对白刺激视频不卡 | 亚洲视频axxx| 久草在 | 一区二区三区在线免费观看视频 | 成人国产一区 | 久久久久久久精 | 国产精品久久久久久久久久妇女 | 日韩在线电影一区二区 | 午夜精品视频福利 | 国产一区二区三精品久久久无广告 | 日韩精品久久一区二区三区 | 高清不卡毛片 | 国产精品乱码久久久 | 成人av一区二区在线观看 | 国产视频在 | av在线成人 | av播放在线 | 久久精品美女视频网站 | 日韩精品一区二区三区免费观看视频 | 97在线观视频免费观看 | 国产亚洲在线视频 | 91一区二区三区在线观看 | 久草热久草视频 | 91人人澡人人爽人人精品 | 91精品专区 | 日韩综合视频在线观看 | 欧美日韩一区二区免费在线观看 | 人人搞人人爽 | 韩国av免费观看 | 亚洲精品资源 | 成人a级黄色片 | 国内精品久久久久国产 | 亚洲综合色丁香婷婷六月图片 | 欧美一级黄色视屏 | 91伊人久久大香线蕉蜜芽人口 | 国产精品久久一区二区三区不卡 | 亚洲精品国产片 | 久久伊人五月天 | 一区在线播放 | 黄av在线 | 亚洲精品国产第一综合99久久 | 中文字幕91视频 | 久久九精品 | 欧美一级电影免费观看 | 热久久视久久精品18亚洲精品 | 天海翼一区二区三区免费 | 又黄又刺激的视频 | 久久人人看 | 99热在线这里只有精品 | 国产精品免费在线播放 | 不卡电影免费在线播放一区 | 最近中文字幕免费av | 色综合久久久久网 | 欧美黑人性猛交 | 欧美日韩性生活 | 日韩一区二区三区在线观看 | 91视频一8mav| 中文字幕国产一区 | 天天干天天想 | 国产在线观看污片 | 六月激情网 | 国产老太婆免费交性大片 | 亚洲视频播放 | 亚洲专区在线视频 | 久久免费视频播放 | 三级免费黄色 | 亚洲香蕉视频 | 亚洲国产精品500在线观看 | 色狠狠久久av五月综合 | 色国产精品一区在线观看 | 亚洲区另类春色综合小说校园片 | 亚洲成人二区 | 欧美色综合久久 | 国产午夜精品福利视频 | 国产字幕在线播放 | 国产99在线免费 | 国产91在线看| www.天堂av| 97人人超碰在线 | 国产成人av免费在线观看 | 91精品一区国产高清在线gif | 片网站 | 日韩乱码中文字幕 | 国产一区二区三区免费在线观看 | 国产精品中文字幕在线播放 | 九九九九九九精品 | 国产黄色精品 | 亚洲视频久久久久 | 激情在线五月天 | 国产精品 999 | 在线网址你懂得 | 干天天| 欧美91精品 | 国产精品久久久久av免费 | 久久精品久久精品 | 日本护士撒尿xxxx18 | 国产精品乱码一区二区视频 | www成人av| 亚洲欧美国产精品18p | 亚洲人xxx| 69视频在线 | 婷婷激情综合 | 日韩三级视频在线观看 | 91重口视频 | 中文字幕乱在线伦视频中文字幕乱码在线 | 夜夜操夜夜干 | 波多野结衣视频一区二区 | 久久精品网站免费观看 | 国产一区二区久久 | 亚洲有 在线 | 在线激情av电影 | 欧美成人久久 | 最新婷婷色 | 日本xxxxav | 国内99视频 | 日韩有码在线观看视频 | 日韩夜夜爽 | 色av色av色av | 一区二区三区在线视频观看58 | 射射色 | 国产精品久久久久久久久久久久午 | 97视频免费在线观看 | 丁香九月激情 | 在线观看日韩 | 久久精品播放 | 色姑娘综合| 日本精品一区二区三区在线观看 | 久久xx视频 | 伊人电影天堂 | 国产.精品.日韩.另类.中文.在线.播放 | av看片在线 | 亚洲精品五月天 | 国产亚洲精品久久19p | 日韩在线观看一区二区 | 在线99热| 久久成人精品电影 | 国产一区在线视频 | 国内精品久久久久久久久久久久 | 国产视频99 | 一区电影 | 国产视频一区在线 | 人人超碰人人 | 亚洲成a人片在线www | 精品欧美乱码久久久久久 | 中文字幕一区二区在线观看 | 99精品影视 | 婷婷色综 | 在线观看黄av | 亚洲男男gaygay无套 | 美国人与动物xxxx | www.久久色 | av网站手机在线观看 | 久久精品爱爱视频 | 国产一级一片免费播放放a 一区二区三区国产欧美 | 国产在线色 | 亚洲 中文 欧美 日韩vr 在线 | 69精品久久久 | 色天天综合网 | 91一区二区三区久久久久国产乱 | 热久久电影 | 国产粉嫩在线 | 99国产精品久久久久久久久久 | 国产一区二区精品 | 国产在线欧美 | 国产69久久久欧美一级 | 91精品国产综合久久福利不卡 | 国产v视频 | 亚洲第一区在线播放 | 欧美日韩国产高清视频 | 亚洲国产av精品毛片鲁大师 | 伊人精品在线 | 欧美精品久久久久久久免费 | 中文字幕在线观看第二页 | 黄色特级一级片 | 免费在线成人 | 香蕉免费在线 | 91九色porny蝌蚪视频 | 少妇搡bbbb搡bbb搡忠贞 | 欧美欧美 | 久久艹久久| 久久99久久精品 | 狠狠的操狠狠的干 | 狠狠色丁香婷婷综合久久片 | 亚洲一级二级三级 | 中文字幕一区二区三区乱码在线 | 中文字幕在线高清 | 婷婷在线不卡 | 69热国产视频 | 日本在线观看一区二区 | 人人插人人澡 | 国产精品久久久免费 | 91精品在线观看入口 | 国产精品美女在线 | 97成人在线免费视频 | 天天操夜夜拍 | 成人wwwxxx视频 | 国产精品日韩久久久久 | 国产亚洲视频系列 | 久久免费国产精品1 | 欧美在线视频一区二区三区 | 天天操天天色天天射 | 亚洲成人午夜在线 | 欧美va天堂va视频va在线 | 国产精品免费视频网站 | 久久欧美精品 | 天天爱天天草 | 日本中文字幕久久 | 香蕉视频在线观看免费 | 天天爽夜夜爽人人爽曰av | 黄色国产在线观看 | 婷婷国产精品 | 亚洲精品在线观看中文字幕 | 久久久久国产精品视频 | 夜夜操天天干, | 91桃色免费视频 | 日本三级香港三级人妇99 | 亚洲精品永久免费视频 | 国产美女精品视频 | 亚洲色图激情文学 | 国产香蕉97碰碰久久人人 | 亚洲1级片 | 成人国产精品免费 | 国产在线观看你懂的 | 欧美a级片免费看 | 国产一区电影在线观看 | 热久精品| 激情五月婷婷综合 | 91.dizhi永久地址最新 | 国产成人在线观看 | www.久久久.cum | 亚洲va在线va天堂 | 青青草国产免费 | 99re在线视频观看 | 中文字幕丝袜美腿 | 国产a视频免费观看 | 国产精品18久久久久久不卡孕妇 | www..com毛片 | 人人玩人人爽 | 黄色av播放| 成人黄色小视频 | 国产最新福利 | 欧美精品国产综合久久 | 亚洲精品 在线视频 | 天天综合操 | 国产精品久久电影网 | 久久激五月天综合精品 | 999久久久免费视频 午夜国产在线观看 | 国产视频一区二区在线观看 | 成人欧美在线 | 狠狠色伊人亚洲综合成人 | 免费a v网站 | 伊甸园永久入口www 99热 精品在线 | 免费视频一二三 | 就色干综合 | 国产精品久久久久久久7电影 | 亚洲国产手机在线 | 91网址在线看 | 国产中文字幕国产 | 天天天综合 | 午夜久久久影院 | 国产精品观看视频 | 国产精品久久麻豆 | 中文字幕人成一区 | 色插综合 | 国语久久 | 在线观看的黄色 | 国产美女视频黄a视频免费 久久综合九色欧美综合狠狠 | 96av在线| 九九免费在线观看视频 | 久久天天躁夜夜躁狠狠85麻豆 | 成人三级av| 久久av免费电影 | 干 操 插 | 色综合久久88色综合天天 | 一性一交视频 | 亚洲 中文 欧美 日韩vr 在线 | 欧美日韩视频在线 | 天天射天| av资源在线看 | 国产日韩欧美在线观看视频 | 中文一区在线 | 九九免费视频 | 正在播放五月婷婷狠狠干 | adn—256中文在线观看 | 在线观看成人毛片 | 四虎伊人 | 精品国产成人av在线免 | 992tv人人网tv亚洲精品 | 精品在线视频一区 | 国产呻吟在线 | 久久久国产精品一区二区中文 | 亚洲国产一区在线观看 | 国产三级国产精品国产专区50 | 尤物97国产精品久久精品国产 | 亚洲视频 在线观看 | 成人欧美一区二区三区在线观看 | 久久全国免费视频 | av免费观看网站 | 国产 一区二区三区 在线 | 精品少妇一区二区三区在线 | 激情综合中文娱乐网 | 狠狠操操 | 亚洲激情综合 | 免费观看全黄做爰大片国产 | 成年人在线看视频 | 免费黄色av片 | 99久久久久久久久久 | 久久99视频免费观看 | 色综合亚洲精品激情狠狠 | 亚洲激情一区二区三区 | 午夜av不卡 | 国产精品日韩久久久久 | 天天做天天爱天天综合网 | 91九色综合| 亚洲天堂香蕉 | 免费在线观看一级片 | 国产精品一区久久久久 | 911香蕉视频 | 日韩av男人的天堂 | 成人av.com| 国产亚洲精品久久久久久网站 | 天天射天天射天天 | 中文字幕永久 | 中文字幕av免费在线观看 | 天堂久久电影网 | 美女网站在线看 | 久久综合精品国产一区二区三区 | 国产人成在线视频 | 2023年中文无字幕文字 | 欧美日韩在线观看视频 | www.福利 | 成人av资源网| 日p在线观看 | 国产老妇av | 欧美一区在线观看视频 | 国产一级特黄电影 | 日韩黄色软件 | 日韩一区二区三区观看 | 高清免费av在线 | 免费三级a | 国产精选在线观看 | 国产精品成人在线 | 中文字幕在线国产 | 亚洲欧美少妇 | 欧美精品在线观看 | 日本黄色免费在线观看 | 日韩欧美久久 | 日韩在线视 | 欧美成人性战久久 | 99精品视频免费看 | 91免费版成人 | 在线播放国产精品 | 亚洲黄色一级视频 | 最近更新的中文字幕 | 国产亚洲日本 | av成人黄色 | 久久久久伊人 | 99在线观看免费视频精品观看 | 91精品国产91久久久久 | 国产日韩高清在线 | 国产精品久久99精品毛片三a | 国产特级毛片aaaaaa高清 | 久久99精品国产麻豆宅宅 | 黄色网址a | 天天天天色综合 | 综合网伊人 | 日韩福利在线观看 | 色播五月激情综合网 | 黄色国产区| 欧美日韩国产在线一区 | 国产精品理论片 | 视频 国产区 | 91一区二区三区久久久久国产乱 | 亚洲精品在线电影 | 三级av片 | 国产很黄很色的视频 | 一区二区三区高清在线 | 91久久奴性调教 | 成人黄色免费在线观看 | 99精品国产一区二区三区不卡 | 国产精品原创av片国产免费 | 久久精品区 | 精品福利在线 | 国产a视频免费观看 | 久久一区精品 | 国产精品国产亚洲精品看不卡15 | 天天舔天天搞 | 久久亚洲欧美日韩精品专区 | 欧美国产日韩在线视频 | 美女很黄免费网站 | 激情五月看片 | 超碰在线国产 | 91在线看视频免费 | 中文字幕在线久一本久 | 美女精品久久久 | 手机成人在线电影 | 国产精品日韩在线播放 | 色狠狠一区二区 | 国产成a人亚洲精v品在线观看 | 国产999久久久 | 黄www在线观看 | 成人影片免费 | 九九热精品在线 | 久久天堂亚洲 | 高清av不卡 | 国产精品久久99综合免费观看尤物 | 久久久久久久亚洲精品 | 日韩在线视频免费看 | 亚洲综合少妇 | 在线99 | 免费av黄色| 亚洲最新精品 | 国产精品美女久久久久aⅴ 干干夜夜 | a级国产乱理论片在线观看 特级毛片在线观看 | 91精品系列 | 一区 二区 精品 | 日韩三级不卡 | 狠狠的操你 | 亚洲欧美日韩国产一区二区 | 国产中文字幕第一页 | 五月天激情视频在线观看 | 日日夜色 | 最新亚洲视频 | 欧美久久久久久久 | 香蕉视频亚洲 | 99热精品久久 | 亚洲黄污 | 国产精品视频免费在线观看 | 日日夜夜噜噜噜 | 久久久久久高潮国产精品视 | 日韩91精品 | 亚洲黄色三级 | 三级黄在线 | 亚洲欧美日韩在线一区二区 | av+在线播放在线播放 | 日日碰狠狠躁久久躁综合网 | 亚洲欧洲精品一区二区精品久久久 | 在线观看香蕉视频 | 日韩精品电影在线播放 | 免费无遮挡动漫网站 | 精品在线一区二区三区 | 国产麻豆剧传媒免费观看 | 亚洲少妇自拍 | www.香蕉视频 | 狠狠狠色丁香婷婷综合久久五月 | 毛片随便看 | 久久久国产高清 | 欧美一级免费 | 激情小说网站亚洲综合网 | 视频在线精品 | 91视频 - 114av | 97品白浆高清久久久久久 | 久久视讯| 深夜免费福利视频 | 欧美va日韩va | 亚洲 欧美 国产 va在线影院 | 美女视频黄是免费的 | 国产成人亚洲在线观看 | 91丨九色丨高潮丰满 | 国产一级特黄毛片在线毛片 | 色婷婷亚洲 | 探花视频在线观看免费版 | 91久久精品日日躁夜夜躁国产 | 久久激情小说 | 有码中文在线 | 又大又硬又黄又爽视频在线观看 | 日韩在线观看网址 | 特级西西www44高清大胆图片 | 久久精品—区二区三区 | 伊人资源视频在线 | 成年人免费av | 久久精品视频免费 | 久久久久久久久久久电影 | 亚洲爱视频 | 日日操天天操狠狠操 | 久久久久久免费视频 | 在线看国产一区 | 九九免费观看视频 | 国产精品人人做人人爽人人添 | av在线免费观看不卡 | 亚洲成人av电影在线 | 欧美一区二区三区免费观看 | 色婷婷福利视频 | 最新日韩中文字幕 | 九九久久成人 | 国产精品一区二区无线 | 亚洲日韩中文字幕在线播放 | 亚洲欧美视频在线播放 | www91在线 | 精品一区二区三区香蕉蜜桃 | 日韩电影中文字幕在线 | 久久久国产在线视频 | 国产精品视频久久久 | 黄色一级大片在线免费看国产一 | 2019中文| 懂色av懂色av粉嫩av分享吧 | 黄色毛片在线观看 | 欧美成人999 | 欧美美女视频在线观看 | 久久免费视频7 | 国产精品区在线观看 | 欧美一级片免费在线观看 | 日韩精品视频在线观看网址 | 日韩动漫免费观看高清完整版在线观看 | 九九九热精品 | 久久人91精品久久久久久不卡 | 视频在线日韩 | 久久手机视频 | 又紧又大又爽精品一区二区 | 日韩久久精品一区二区三区下载 | 在线观看国产区 | 青草视频免费观看 | 人人揉人人揉人人揉人人揉97 | 欧美与欧洲交xxxx免费观看 | 9草在线 | 人人爱夜夜操 | 96av视频 | 国产一区视频在线 | 91九色精品 | 99久久国产免费看 | 久久精品日本啪啪涩涩 | 精品久久久久久久久久久久久久久久久久 | 日韩视频1 | 日韩欧美在线免费 | 日韩在线观看视频一区二区三区 | 精品一区二区综合 | 国产成人精品区 | 人人搞人人爽 | 热久久国产精品 | 欧美日韩精品网站 | 一区二区三区在线看 | 中文字幕免费高清在线 | av三级在线看| 欧美日韩国产二区三区 | 精品福利在线视频 | 五月婷婷视频在线 | 欧美人体xx| 国产视频 亚洲精品 | 国语久久 | 欧美analxxxx| 99热在线观看免费 | 欧美日韩裸体免费视频 | 最新日韩在线 | 免费看的黄色 | 国产成人精品久久亚洲高清不卡 | 久久精品网站免费观看 | 免费视频在线观看网站 | 国产日韩视频在线观看 | 国内精品久久久精品电影院 | 日韩精品视频免费专区在线播放 | 成人在线视频免费观看 | 国产中文字幕亚洲 | 中文字幕在线专区 | 国产精品男女啪啪 | 中文字幕乱在线伦视频中文字幕乱码在线 | 亚洲一区二区麻豆 | 国产精品久久久久久五月尺 | 狠狠色狠狠色综合日日92 | 精品特级毛片 | 国产成人免费网站 | 9久久精品 | a爱爱视频 | 久草在线久草在线2 | 色99视频 | 九色porny真实丨国产18 | 久久久久久免费网 | 精品99在线视频 | 91精品国产高清自在线观看 | 亚洲男女精品 | 日韩精品中文字幕在线观看 | 亚洲精品三级 | 日日干日日操 | 99国内精品久久久久久久 | 亚洲精色| 成人日韩av| 黄色亚洲 | 久久久国产成人 | 亚洲免费在线看 | 人人看人人做人人澡 | 久久视频99 | 亚洲女在线 | 在线播放你懂 | 国产69精品久久久久9999apgf | 免费在线观看国产精品 | 国产精品24小时在线观看 | 久久夜视频 | 欧美日韩国产精品一区 | 久久最新网址 | 免费观看9x视频网站在线观看 | 久久精品久久久久 | 麻豆影视网 | 日韩欧美在线综合网 | 视频成人 | 日韩欧美电影在线 | 日日麻批40分钟视频免费观看 | 日韩精品免费专区 | 网站在线观看日韩 | 成人亚洲精品久久久久 | 亚洲一区二区三区在线看 | 六月色丁 |