日韩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)容還不錯,歡迎將生活随笔推薦給好友。

操久久免费视频 | 亚洲一区二区三区四区在线视频 | 免费的黄色的网站 | 婷婷在线综合 | 黄色一区二区在线观看 | 久久免费国产 | 精品亚洲欧美一区 | 激情小说网站亚洲综合网 | 天天干,夜夜操 | 网站在线观看日韩 | 久久久久影视 | 久久黄网站 | 日本99热| 国产成人一区二区三区电影 | 深爱激情综合网 | 亚洲亚洲精品在线观看 | www.久久99| 伊人日日干 | 亚洲综合少妇 | 成人午夜黄色影院 | 国产精品一区二区在线 | 久久久久亚洲精品国产 | 久久久免费少妇 | 人九九精品 | 国产69久久 | 日韩在线视频免费播放 | 91久久精 | 国产精品一区二区精品视频免费看 | 最近日本韩国中文字幕 | 亚洲精品久久视频 | 婷婷综合成人 | 蜜臀aⅴ精品一区二区三区 久久视屏网 | 亚洲欧美激情精品一区二区 | 激情久久久| 国产在线看一区 | 成人在线免费看视频 | 人人狠狠综合久久亚洲婷 | 久久午夜羞羞影院 | 精品一二三区 | 中文一二区 | 亚洲午夜小视频 | 日日摸日日爽 | 色综合久久久久久久久五月 | 伊人影院得得 | 久久免费视频这里只有精品 | 91亚洲精品久久久蜜桃 | 国产精品成人久久 | 韩国精品视频在线观看 | 91禁看片| 最新日本中文字幕 | 国产精品久久久久久一二三四五 | 久久黄色免费观看 | 91麻豆视频网站 | 亚洲综合精品在线 | 综合视频在线 | 九色精品免费永久在线 | 91精品免费视频 | 黄网站app在线观看免费视频 | 视频国产在线观看18 | 国产91av视频在线观看 | 欧美日韩亚洲精品在线 | 国产成年免费视频 | 亚洲精品国产自产拍在线观看 | 99久久久久成人国产免费 | 国产视频黄 | 麻豆传媒视频在线 | 日韩国产精品久久久久久亚洲 | 五月天电影免费在线观看一区 | 欧美一区二区日韩一区二区 | 欧美精品在线一区 | 99热999| 国产资源网站 | 人人澡人人模 | www国产亚洲精品久久麻豆 | 激情综合亚洲 | 在线日韩中文字幕 | 久草视频资源 | 国产精品白丝jk白祙 | 91av视频在线观看免费 | 亚洲天堂网在线播放 | 欧美日韩精品国产 | 色综合久久久网 | 欧美性受极品xxxx喷水 | 国产视频在线播放 | 91av视频网站| 99精品乱码国产在线观看 | 久久不见久久见免费影院 | 成人免费在线看片 | 亚洲免费不卡 | 91九色蝌蚪在线 | 欧美精品一区二区免费 | 日韩素人在线观看 | 天天干天天拍天天操天天拍 | 在线性视频日韩欧美 | 国产精品 亚洲精品 | 国产免费一区二区三区网站免费 | 国产字幕在线看 | 国内精品久久久久久久久久清纯 | 国产视频不卡一区 | 亚洲 欧洲av | 激情五月婷婷综合 | 国产又黄又硬又爽 | 伊人婷婷在线 | 日韩欧美一区二区在线观看 | 日韩在线视频观看免费 | 国产视频一二区 | 久久国产精品视频观看 | 波多野结衣亚洲一区二区 | 在线 成人 | 中文字幕日本在线观看 | 99精品免费在线观看 | 日韩欧美精选 | 99tvdz@gmail.com | 国产韩国精品一区二区三区 | 免费a网址 | 欧美韩国在线 | 超碰激情在线 | 天天干 天天摸 天天操 | 国产精品午夜久久久久久99热 | 在线激情影院一区 | 成人午夜电影免费在线观看 | 啪一啪在线 | 激情av在线播放 | 91精品秘密在线观看 | 日韩欧美有码在线 | 久久99亚洲精品久久久久 | 国产精品a成v人在线播放 | 国产精品乱码久久久久 | 人人玩人人添人人澡97 | 欧美激情精品久久久久久 | 91av免费在线观看 | 日韩在线观看视频一区二区三区 | 精品福利网 | 精品一区二区三区在线播放 | 亚洲精品久久久久中文字幕二区 | 免费视频久久久久 | 四虎成人精品在永久免费 | 欧美日在线观看 | 国产一区二区三区午夜 | 97高清免费视频 | 青青河边草手机免费 | 国产精品精品国产 | 在线播放日韩av | 成人免费观看a | 91精品国产一区二区在线观看 | 精品久久久免费视频 | 久久久久免费电影 | 国产一卡二卡在线 | 91九色网址 | 久久精品激情 | 亚洲一区视频免费观看 | 久久久资源 | 中文字幕九九 | 成人avav| 久久视频免费观看 | 91中文在线 | 香蕉影视在线观看 | 免费看国产精品 | 啪一啪在线 | 精品av网站 | 2019天天干夜夜操 | 99精品视频在线观看视频 | 久久国产精品色av免费看 | 一级黄色大片在线观看 | www.com操| av手机在线播放 | 国产九色在线播放九色 | 不卡电影免费在线播放一区 | 激情婷婷亚洲 | 欧美激情综合五月色丁香 | 国产成人av网站 | 在线观看免费视频你懂的 | 国产麻豆果冻传媒在线观看 | 91色在线观看 | 午夜在线免费观看视频 | 九色最新网址 | 中国精品少妇 | 久久99深爱久久99精品 | 久久久久久久久久久久久影院 | 在线成人免费电影 | 国产成人精品免高潮在线观看 | 最近最新最好看中文视频 | 欧美一区中文字幕 | av+在线播放在线播放 | 久久久穴 | 福利在线看片 | 天天干天天射天天爽 | 91精品视频一区 | 亚洲电影av在线 | av在线免费在线观看 | 最新亚洲视频 | 色九九视频 | aaa免费毛片| 久久久久久久久久免费 | 色综合婷婷久久 | 最近字幕在线观看第一季 | 亚洲精品国偷自产在线99热 | 国产精品视频免费在线观看 | 欧美日韩色婷婷 | 91日韩精品视频 | 日韩免费小视频 | 天天操天天摸天天射 | 黄色av电影一级片 | 国产精品一区在线观看你懂的 | 久久久久亚洲精品中文字幕 | 国产视频精品久久 | 国产在线免费 | 91在线porny国产在线看 | 精品一区二区在线免费观看 | 国产又粗又猛又色又黄网站 | a午夜在线| 日韩在线精品视频 | 婷婷精品在线视频 | 国产精久久久久久妇女av | 午夜视频欧美 | 999久久久欧美日韩黑人 | 国产成人一区二区精品非洲 | 久草视频手机在线 | 中文区中文字幕免费看 | 日本h视频在线观看 | 国产福利在线不卡 | 国产美女视频免费 | 亚洲成av人片在线观看www | 中文av网 | 久久精品—区二区三区 | 手机在线看片日韩 | 日韩高清免费电影 | 66av99精品福利视频在线 | 可以免费看av | 在线之家免费在线观看电影 | 色婷婷视频在线观看 | 97视频人人| 国产亚洲精品综合一区91 | 亚洲国产精品小视频 | 亚洲综合成人在线 | 中文字幕日韩电影 | 欧美精品一区二区三区四区在线 | 久久久久久蜜桃一区二区 | 日日夜夜天天综合 | 99久久久久久久久久 | 久草在线视频免费资源观看 | 成人观看视频 | 精选久久| 日韩av电影中文字幕在线观看 | 啪啪免费观看网站 | 欧美一进一出抽搐大尺度视频 | 麻豆mv在线观看 | 欧美十八| 亚洲欧美综合精品久久成人 | 国内精品美女在线观看 | 天天噜天天色 | www.在线看片.com | 久久专区 | 成人手机在线视频 | 国产一二三在线视频 | 99久久这里有精品 | 色鬼综合网 | 欧美色噜噜 | 日韩av手机在线看 | 亚洲欧美日韩国产一区二区三区 | 国产理论影院 | 天堂av在线网站 | 欧美成人免费在线 | 91丨九色丨高潮 | 精品国产精品久久一区免费式 | 久久歪歪| 国产麻豆精品在线观看 | 最近中文字幕 | 久久成人18免费网站 | 亚洲中字幕 | 亚洲人天堂 | 最新国产中文字幕 | 久久久96 | 久久理论片 | 激情视频在线高清看 | 久久久久久久久久久久久久免费看 | 日韩精品一区二区三区在线视频 | 久久久久色 | 玖玖玖在线 | ,午夜性刺激免费看视频 | 伊人婷婷综合 | 免费福利视频网 | av在线一级 | 国产在线第三页 | 天天搞夜夜骑 | 国产成人三级三级三级97 | 免费观看www7722午夜电影 | 国产福利91精品一区 | 亚洲精品国产品国语在线 | 国产亚洲欧美精品久久久久久 | 国产精品一区二区三区在线看 | 中文字幕一区二区三区四区视频 | 久久精品人人做人人综合老师 | 最新国产精品拍自在线播放 | 久久精品播放 | 在线观看一二三区 | 五月婷婷六月丁香在线观看 | 国产成人久久久久 | 91大神在线看 | 免费男女网站 | 成人黄色短片 | 91x色| 丁香在线| 亚洲天堂精品 | 99久久99| 午夜丰满寂寞少妇精品 | 欧美a级成人淫片免费看 | 日韩视频中文字幕 | 玖玖在线看 | 欧美日韩精品在线播放 | 日韩性久久| 色噜噜在线观看 | 亚洲国产经典视频 | 久艹视频在线观看 | 91精品在线看 | 操夜夜操 | 波多野结衣小视频 | 国产99久久精品一区二区300 | 免费在线观看成人小视频 | 97视频在线免费 | 欧美日韩国产色综合一二三四 | 久久国产精品免费 | 国产二区av | 四月婷婷在线观看 | 91精品国产乱码久久 | 亚洲精品视频在线播放 | 日韩视频在线不卡 | 黄色软件视频网站 | 天天操夜夜操夜夜操 | 亚洲精品男人的天堂 | 国产 一区二区三区 在线 | 午夜性色 | 日本不卡视频 | 2022久久国产露脸精品国产 | 久久精品91久久久久久再现 | 99精品系列| 久久国产精品小视频 | 久草国产在线观看 | 国产精品正在播放 | 99精品一级欧美片免费播放 | 久草精品视频 | 三级a毛片| 午夜av大片 | 久久国内精品 | 日韩视频精品在线 | 日韩精品免费一区 | 国产精品久久久久久久久久久久冷 | 在线看片一区 | 久久99亚洲精品久久 | 亚洲精品免费在线观看 | 久久人人爽人人人人片 | 日本精a在线观看 | 欧美极品少妇xxxxⅹ欧美极品少妇xxxx亚洲精品 | 国产91在线播放 | 精品国产电影一区二区 | 在线观看视频97 | 国产69精品久久99的直播节目 | 欧美色图东方 | 国产伦精品一区二区三区无广告 | 超碰人人草人人 | 免费看成人| 在线视频18在线视频4k | 亚洲国产黄色 | 国产在线不卡一区 | 精品一区91 | 麻豆一级视频 | 免费观看成年人视频 | 五月婷婷,六月丁香 | 精品中文字幕在线播放 | 国产精品久一 | 亚洲天堂首页 | 久久精品aaa | 国产这里只有精品 | 青草草在线视频 | 久久国产精品色婷婷 | 一本色道久久精品 | 国产精品久久二区 | 狠狠干.com | www.天天色| www.av免费 | 天天综合天天做天天综合 | 国产糖心vlog在线观看 | 欧美电影黄色 | 中文字幕一区在线观看视频 | 天天干天天干天天操 | 在线观看岛国av | 黄色成人av | 国产精品九九久久99视频 | 黄在线免费看 | 国产精品一区二区三区在线看 | 日韩xxxx视频 | 亚洲精品欧美视频 | 500部大龄熟乱视频 欧美日本三级 | 综合五月婷婷 | 国产精品99久久久久久人免费 | 免费在线观看av不卡 | 免费成人在线视频网站 | 黄色毛片在线 | 亚洲精品久久久久中文字幕m男 | 亚洲精品久久视频 | 免费又黄又爽视频 | 国产精品96久久久久久吹潮 | 久久高清视频免费 | 二区三区在线视频 | 久久久久日本精品一区二区三区 | 丰满少妇高潮在线观看 | 日韩丝袜 | 国产小视频精品 | 国产精品99久久久久人中文网介绍 | 国产二区免费视频 | 日韩久久精品一区二区三区 | avsex| 97国产视频 | 波多野结衣视频一区二区 | 国产高清在线免费观看 | 麻豆免费在线播放 | 亚洲国产精品激情在线观看 | 成人毛片一区 | 免费观看性生活大片3 | 成人免费亚洲 | 日韩精品久久久久久久电影竹菊 | 国产日韩欧美在线观看视频 | 国产精品美女视频网站 | 99精品一级欧美片免费播放 | 亚洲欧美综合精品久久成人 | 亚洲 欧美 综合 在线 精品 | 中文字幕在线视频国产 | 午夜精品视频一区 | 免费网站在线观看成人 | 麻豆国产视频 | 欧美一级免费黄色片 | 久久久这里有精品 | 三上悠亚一区二区在线观看 | 久久久久久久电影 | 玖玖在线资源 | 亚洲电影久久久 | 久久av在线 | 在线观看的黄色 | 99视频精品免费观看, | 手机在线视频福利 | 东方av在线免费观看 | 亚洲国产婷婷 | 国产在线精品二区 | 狠狠色丁香久久婷婷综 | 黄色软件在线观看 | 91在线影视 | 天天综合色 | 成人蜜桃网 | 日本黄色免费大片 | 欧美成人久久 | 91亚洲精品久久久蜜桃借种 | 伊人久久国产精品 | 四虎在线免费视频 | 五月天色站 | 99一区二区三区 | 国产一线二线三线性视频 | 色香蕉在线视频 | 综合国产视频 | 日韩在线视 | 日本中文字幕在线看 | 中文字幕乱码电影 | 九九九热| 日韩欧美视频在线观看免费 | 欧美a视频在线观看 | 免费精品国产va自在自线 | 午夜精品一区二区三区免费视频 | 欧美999| 狠狠色丁香婷婷综合最新地址 | 欧美精品xxx | 久九视频 | 中文字幕欧美日韩va免费视频 | 国产99自拍 | 久草在线最新 | 97成人在线视频 | 亚洲在线a | 久久爱www. | 久久99久国产精品黄毛片入口 | 国产字幕在线看 | 天天拍天天草 | 国产在线观看中文字幕 | 国产啊v在线 | 亚洲精品五月 | 久久高清免费视频 | 夜夜高潮夜夜爽国产伦精品 | 外国av网 | 超碰人人干人人 | 国产精品第 | 五月天色中色 | 国产精品精品久久久久久 | 欧美日韩在线第一页 | 麻豆一级视频 | 最新日韩电影 | 日本在线观看一区二区三区 | 日日操夜夜操狠狠操 | 国产免费久久久久 | 国产99免费| 日韩a在线观看 | 国产亚洲资源 | 久久精品伊人 | 日韩免费成人 | www夜夜| 久久久久久国产精品免费 | 日韩在线观看视频一区二区三区 | 69亚洲精品 | 亚洲国产成人精品久久 | 久草精品视频在线看网站免费 | a√天堂中文在线 | 久久在线视频在线 | 亚洲国产激情 | 日本xxxx.com | 国产一区在线观看免费 | 午夜.dj高清免费观看视频 | 日韩av中文在线观看 | 日韩精品不卡在线 | 天天干,天天草 | 伊人婷婷激情 | 在线亚洲激情 | 在线观看精品一区 | 国产精品久久久久久久久久久久午 | 国产亚洲欧洲 | 久久久久久久18 | 亚洲国产精品一区二区久久hs | 视频国产在线观看18 | 婷婷精品国产欧美精品亚洲人人爽 | 欧美日韩在线视频观看 | 色鬼综合网 | 最新在线你懂的 | 亚洲黄色成人网 | 91在线入口 | 亚洲成人av一区 | 五月婷在线 | 免费看黄在线观看 | 日韩在线视频免费看 | 欧美日韩在线电影 | 天天干天天干天天干天天干天天干天天干 | 精品一区二区在线播放 | 热re99久久精品国产66热 | 精品亚洲国产视频 | 免费视频黄 | 99九九99九九九视频精品 | 麻花豆传媒mv在线观看 | 精品国产伦一区二区三区观看体验 | 国产精品美女在线观看 | 丁香花在线观看免费完整版视频 | 成人久久久精品国产乱码一区二区 | 日韩免费观看视频 | 一区二区三区电影 | 蜜臀av性久久久久av蜜臀妖精 | 国产午夜精品理论片在线 | 91中文在线观看 | 亚洲成人一二三 | 亚洲精品mv在线观看 | 国产91免费看 | 国产一级免费观看视频 | 九九视频免费观看视频精品 | 久久av网| 人人讲 | 91黄色视屏 | 天天综合成人 | 欧美男同网站 | 中文字幕日本电影 | 国产精品毛片一区二区 | 国产特黄色片 | 国产精品久久免费看 | 五月开心激情网 | 国产99久久久久 | 手机在线看a | 99国内精品久久久久久久 | 成年人免费电影 | 日日操夜夜操狠狠操 | 久草在线最新免费 | 亚洲作爱视频 | 成人黄色av网站 | 91九色porny蝌蚪主页 | 亚洲国产三级在线 | 亚洲精品短视频 | 中文有码在线视频 | 日韩av一区二区在线 | 中文字幕免费一区 | 国产精品大全 | 亚洲成人资源在线 | 国产亚洲欧美在线视频 | av成人免费在线观看 | 在线 精品 国产 | 精品一区二区电影 | 在线观看一级视频 | 成年人免费在线播放 | 婷婷视频在线播放 | 日本动漫做毛片一区二区 | 激情av综合| 日韩午夜一级片 | 波多野结衣视频在线 | a视频免费在线观看 | 又爽又黄在线观看 | 日韩四虎 | 一区二区三区四区五区在线 | 在线国产视频观看 | 日韩av看片| 久久久高清免费视频 | 视频在线观看入口黄最新永久免费国产 | 激情综合站 | 久久成人欧美 | 精品产品国产在线不卡 | 一级性视频 | av中文在线影视 | 夜色.com| 精品爱爱 | 久久精品男人的天堂 | 国产精品 国内视频 | av免费看在线 | 亚洲人人爱| 久艹在线观看视频 | 久久国产精品区 | 日本免费久久高清视频 | 国产淫片免费看 | 日韩一区二区三区免费电影 | 国产香蕉97碰碰碰视频在线观看 | 99视| 亚洲精品乱码久久久久久蜜桃动漫 | 国产精品久久二区 | 亚洲精品视频在线观看免费视频 | 午夜精品av在线 | 国产黄色精品在线观看 | 亚洲国内在线 | 久久久久久福利 | 天天色天天上天天操 | 久久精品99国产 | 国产精品毛片一区二区在线看 | 黄色视屏在线免费观看 | 亚洲欧美少妇 | 久久人人爽人人片av | 免费一级片在线观看 | wwwwwww黄| 欧美日韩成人一区 | 毛片网在线观看 | 国产精品久久久久久久av电影 | 在线视频成人 | 激情电影影院 | 久久99这里只有精品 | 免费日韩一区二区三区 | 国产精品高清一区二区三区 | 国产成人在线播放 | 日韩精品久久久久久 | 亚洲视频免费在线 | 欧美性色19p | 国产高清福利在线 | 国产精品视频久久久 | 国产一二三区在线观看 | .国产精品成人自产拍在线观看6 | 日本精品一二区 | 国产美女视频免费观看的网站 | www.夜夜骑.com | 欧美激情精品久久久 | 亚洲免费专区 | 国产福利久久 | 一级黄色免费网站 | 激情综合国产 | 亚洲在线视频网站 | 国产露脸91国语对白 | 在线国产激情视频 | 日本公妇在线观看 | 欧美日韩国产精品爽爽 | 97视频人人澡人人爽 | 久草在线欧美 | 99国产成+人+综合+亚洲 欧美 | 97视频网站| 亚洲视频综合在线 | 天天操天天干天天爽 | 国产成人一区二区三区影院在线 | 亚洲综合欧美激情 | 操操操天天操 | 国产成人精品999在线观看 | 少妇资源站 | 999成人 | 91麻豆精品国产91久久久使用方法 | 一级一片免费视频 | 免费av片在线| 国产手机免费视频 | 蜜桃av人人夜夜澡人人爽 | 亚州性色 | 国产免费一区二区三区最新6 | 在线观看一级 | 色小说在线 | 久久综合五月天 | 88av视频| 亚洲成人999 | 久草综合在线观看 | 国产爽妇网| 99精品福利视频 | 国产a网站 | 狠狠色伊人亚洲综合成人 | 国产精品资源在线 | 亚洲精品中文字幕视频 | 欧美永久视频 | 玖玖国产精品视频 | 日本最新一区二区三区 | 91视频成人免费 | 最新国产在线观看 | 日韩在线观看视频一区二区三区 | 日韩av电影免费在线观看 | 亚洲韩国一区二区三区 | 国产毛片在线 | 永久免费av在线播放 | 国产黄色在线观看 | 午夜精品久久久久久久99 | 狠狠操操网| 精品一区免费 | 国产亚洲精品久久 | 久久免费毛片视频 | 欧美亚洲另类在线视频 | 国产激情免费 | 久久9999久久免费精品国产 | 午夜在线免费观看 | 国产中文字幕一区二区三区 | 在线91播放| 精品国内自产拍在线观看视频 | 色资源网在线观看 | av中文字幕在线播放 | 免费在线观看污网站 | 日韩激情第一页 | 国产又粗又硬又爽的视频 | 国产91小视频 | 成人在线免费av | 日韩最新av| 日日摸日日碰 | 成人91免费视频 | 三级在线视频观看 | 久久短视频 | 亚洲激情中文 | 欧美一区二区三区在线 | 欧美色图视频一区 | 日韩免费一区二区三区 | av中文字幕在线观看网站 | 手机在线欧美 | 在线视频一区二区 | 国产福利精品在线观看 | 亚洲经典精品 | 欧美日韩国产在线一区 | 波多野结衣久久精品 | 午夜精品久久久久久久99无限制 | 99视频网站| 中文字幕九九 | 国产免费又爽又刺激在线观看 | 成人黄性视频 | 色五月色开心色婷婷色丁香 | 国产精品久久久久久久午夜片 | 免费视频 三区 | 高清av免费看 | 精品日韩在线一区 | 开心激情久久 | 亚洲国产精品传媒在线观看 | 国产日产精品一区二区三区四区的观看方式 | 成片视频免费观看 | 国产成人在线精品 | 精品国产精品久久一区免费式 | 午夜精品久久久久久99热明星 | 天天射色综合 | 开心综合网 | 日日夜夜爱 | www.五月婷 | 午夜精品99久久免费 | 美女网站在线观看 | 国内99视频| 在线三级av| 不卡的av在线 | 国产在线a | 狠狠狠狠狠狠狠干 | 久久久在线免费观看 | 超碰人人草人人 | 国产精品一区二区吃奶在线观看 | 国产999精品 | 天天干天天干天天 | 国产亚洲精品久久久久久无几年桃 | 久久精品中文字幕一区二区三区 | 日日插日日干 | 亚洲国产播放 | 丁香婷婷综合网 | 久久久久久久久久伊人 | 五月色丁香 | 视频在线观看一区 | 天天摸天天舔天天操 | av一级在线 | 在线黄色免费 | 国产999精品久久久久久绿帽 | 亚洲一区二区三区四区精品 | 免费福利在线 | 国产xvideos免费视频播放 | 国产高清av免费在线观看 | 久久综合影音 | 免费久久99精品国产 | 国产一区二区日本 | 国产精品 国内视频 | 日本中文字幕观看 | www.狠狠色 | 成人超碰在线 | 蜜臀久久99精品久久久酒店新书 | 欧美日本国产在线观看 | 国产不卡在线视频 | 亚洲激情综合 | 日日夜夜天天久久 | 天天干,天天射,天天操,天天摸 | 成年人视频免费在线 | 久久九九久久 | 国产成人精品一区二区三区网站观看 | 日韩高清国产精品 | 色婷婷国产精品 | 天天天天天天天操 | 高清国产一区 | 日日夜色 | 国产小视频在线免费观看视频 | 国产精品国产三级国产aⅴ入口 | 国产成人精品在线播放 | 欧美精品一区在线 | 综合影视 | 久久免费视频在线观看30 | 久久福利国产 | 午夜精品一区二区三区免费视频 | 99re8这里有精品热视频免费 | 福利一区在线视频 | 免费在线观看一级片 | 久久久精品国产免费观看同学 | 99在线视频免费观看 | 国内精品免费久久影院 | 久久久久久久久亚洲精品 | 在线观看日本韩国电影 | 午夜精品久久久久久久久久久久久久 | 欧美在线aaa | 午夜精品电影 | av九九九| 亚洲精品国偷拍自产在线观看 | 久久久久亚洲精品 | 91网页版免费观看 | 国产精品精品久久久久久 | 91精品免费看 | 亚洲永久字幕 | 西西4444www大胆无视频 | 亚洲综合视频在线播放 | 色网站在线看 | 欧美成人精品三级在线观看播放 | 久久精品网站免费观看 | .国产精品成人自产拍在线观看6 | 欧美精品免费在线 | 中文字幕不卡在线88 | 亚洲伦理一区二区 | 91理论电影 | 五月天婷婷在线观看视频 | 18国产精品福利片久久婷 | 91精品国产99久久久久 | 91久久精品一区 | 男女啪啪视屏 | 国产特级毛片aaaaaa毛片 | 久久久久久中文字幕 | 99精品在线视频观看 | av免费网页 | 97超碰人人模人人人爽人人爱 | av免费在线观 | 国产精品国产三级国产专区53 | 日本特黄特色aaa大片免费 | 91最新中文字幕 | 国产精品久久99综合免费观看尤物 | 久久久久黄 | 亚洲精品国产品国语在线 | 国产视频2区 | 视频成人 | av一本久道久久波多野结衣 | 久久免费国产精品 | 一区二区视频网站 | 中文字幕免费播放 | 99精品视频免费全部在线 | 国产精品国产三级国产不产一地 | 五月天六月丁香 | 亚洲在线视频免费观看 | 成人免费视频网站在线观看 | 开心色激情网 | av一级黄| 8x成人免费视频 | 久久久久激情电影 | 欧美日韩精品在线观看 | 亚洲美女免费精品视频在线观看 | 丁香色婷婷 | 精品视频免费在线 | av福利在线播放 | 色在线亚洲 | 一级特黄aaa大片在线观看 | 天天综合成人网 | 成人午夜电影在线播放 | 制服丝袜成人在线 | 久久av黄色 | 99在线国产| 成人在线视频免费看 | 日韩精品一区二区在线视频 | 婷婷伊人综合亚洲综合网 | 三级在线视频播放 | 久久伊99综合婷婷久久伊 | 日韩在线国产精品 | 亚洲国产资源 | 中文字幕在线观看免费 | 久久午夜鲁丝片 | 91网址在线看 | 欧美日韩中文在线观看 | 九九热视频在线免费观看 | 久草在线网址 | 欧美日韩午夜在线 | 久久99视频免费观看 | 国产高清一 | 美女视频又黄又免费 | 欧美极品少妇xxxxⅹ欧美极品少妇xxxx亚洲精品 | 日日夜色| 99精品色 | 久久精品影片 | 天天鲁天天干天天射 | 久久精品视| 国内精品久久久精品电影院 | 天天干天天操人体 | 日韩网站一区二区 | 91精品亚洲影视在线观看 | 亚洲天堂网在线视频观看 | 久久久免费 | 一区二区视频免费在线观看 | 狠狠干成人 | 国产午夜一区二区 | 成人久久18免费网站图片 | 337p欧美 | 国产va在线 | 久久精品激情 | 欧美日韩一区二区免费在线观看 | 日韩久久精品一区二区三区下载 | 天天色官网 | 国产精品6999成人免费视频 | 久精品视频在线观看 | 日韩偷拍精品 | 亚洲欧美综合精品久久成人 | 日韩免费在线观看 | 国产精品久久99精品毛片三a | 国产午夜亚洲精品 | 草久在线观看视频 | 国精产品一二三线999 | 亚洲欧美少妇 | 天天看天天干 | 麻豆一精品传二传媒短视频 | 国产精品第三页 | 最近av在线| 九九热免费观看 | 色视频网址 | www.com黄色| 91亚洲精品久久久久图片蜜桃 | 久久免费成人精品视频 | 亚洲天堂社区 | 国产精品一区二区美女视频免费看 | www激情网 | 九九99| 天天草天天 | 国产视频亚洲 | 午夜国产一区二区三区四区 | 伊人资源视频在线 | 国产免费叼嘿网站免费 | 六月天综合网 | 六月丁香社区 | 日本精品中文字幕在线观看 | 69视频永久免费观看 | 久久久久国产精品免费 | 人人澡人人添人人爽一区二区 | 午夜影院日本 | 在线观看免费观看在线91 | 日本久久久久久久久久 | 国产成人在线播放 | 国产精品久久久久久影院 | 99c视频在线 | www.午夜色.com | 国产精品美女久久久久久网站 | www.色午夜 | 99re国产| 日日综合网 | 中文字幕在线免费看线人 | 久久99亚洲精品 | 日本在线观看黄色 | 亚洲va欧美 | 免费污片 | 国产精品成人av电影 | 超碰999 | 91亚洲国产| 色狠狠婷婷 | 中文字幕国语官网在线视频 | 国产黄在线 | 免费在线观看国产精品 | 久久视频网 | 永久黄网站色视频免费观看w | 91免费的视频在线播放 | 亚洲 欧美 另类人妖 | 在线观看中文av | 免费亚洲片 | 黄色大全视频 | 夜夜爽88888免费视频4848 | 欧美成年人在线视频 | 国产三级久久久 | 欧美日韩中文字幕在线视频 | 亚洲黄色网络 | 久久蜜臀一区二区三区av |