laravel collection filter

Solutions on MaxInterview for laravel collection filter by the best coders in the world

showing results for - "laravel collection filter"
Jaylen
04 Jun 2017
1$collection = collect([1, 2, 3, 4]);
2
3$filtered = $collection->filter(function ($value, $key) {
4    return $value > 2;
5});
6
7$filtered->all();
8
9// [3, 4]
Camila
23 Mar 2018
1// The array we're going to return
2    $data = [];    
3// Query the users table
4$query = users::where('id', 1)->get();
5
6// Let's Map the results from [$query]
7$map = $query->map(
8    function($items){
9          $data['user_firstName'] = $items->firstName;
10          $data['user_lastName'] = $items->lastName;
11          return $data;
12        }
13    );
14
15return $map;
Maria
12 Jun 2019
1$itemCollection = collect($contacts);
2$filtered = $itemCollection->filter(function($item) use ($search) {
3    return stripos($item['username'],$search) !== false;
4});
5
Erica
22 Jan 2019
1$collection = collect([1, 2, 3]);
2
3$total = $collection->reduce(function ($carry, $item) {
4    return $carry + $item;
5});
6
7// 6
8
9$total = $collection->reduce(function ($carry, $item) {
10    return $carry + $item;
11}, 4);
12
13// 10   | where 4 is a initial value
Alex
27 Feb 2020
1$collection = collect([1,2,3,4]);
2
3$collection->each(function($item){
4    return $item*$item;
5});
6
7// [1,4,9,16]
Linda
08 Sep 2016
1public function index()
2{
3    $myStudents = [
4        ['id'=>1, 'name'=>'Hardik', 'mark' => 80],
5        ['id'=>2, 'name'=>'Paresh', 'mark' => 20],
6        ['id'=>3, 'name'=>'Akash', 'mark' => 34],
7        ['id'=>4, 'name'=>'Sagar', 'mark' => 45],
8    ];
9  
10    $myStudents = collect($myStudents);
11   
12    $passedstudents = $myStudents->filter(function ($value, $key) {
13        return data_get($value, 'mark') > 34;
14    });
15   
16    $passedstudents = $passedstudents->all();
17   
18    dd($passedstudents);
19}
queries leading to this page
laravel collect methodlaravel filter withlaravel pulcklararvel filter pagefilter data laravel phpwith in laravel collectionget and filter the collection in laravellaravel filter for examplelaravel colelctionslaravel collection values laravel collection somelaravel collection where functionlaravel collection sumfilter collection laravecollect 28 40 29 laravelhow to filter a collection in laravel with strstrihow to add a filter in laravellaravel collection filter by valuwhere filter in laravellaravel collection reduce exampleeloquent pluck indexed arraylarave collection map laravel return filterlaravel reduce arraycreating and extending collections laravelmap by key laravel eloquentlaravel collection operationslaravel eloquen collection filterlaravel filtering techniqueshow to make a filter on laravellaravel example collection laravel collect laravel sortby on cursor without indexescollection of objects laravelmap on collection laravellarave reducelaravel collection map and eachbest way to make filter in laravel datalaravel where collectionfilter php laravelemplremove element from collection laravellaravel collection methodsmap function collection laraveladd filter in laravel 7laravel collection 27 5c filterlaravel filter objecthow to chunk collection in laravel 3 3 2 3with filter in laravellaravel collection map key valuecollection filter in blade laravellaravel collection exampleslaravel collection for a modelfilter with additional laravelfilter collection laravelsum in end of collection laravellaravel collection uniquecollect laravel functionfilter on collection in laravellaravel 4 filterpluck set of elements from collection laravelfilters laravel jsuse laravel collection in wordpressforeach is filtering some data laravellaravel collection filter columnmake collection in laravelsplice laravel collectioncollections methods laravelcollection 3d laravellaravel 8 filterslaravel how filterfilter in with laravelhow to define methods for a collection in laravelmap function laravel collectionlaravel toarrayfiltering package in laraveldefining collection with items in laravellaravel collection chunklaravel array reduceslice 280 2c 5 29 laravellaravel collectionslaralve collction map laravel collections get linksfilters php in laravelhow to filter collections in laravellaravel map with load functionspluck in laravellaravel collection randomreduce in laravelfilters laravelfilter by laravelsort laravellaravel collection mapolaravel map function collectionhow to get key number in toarray method in laravelhow to chunk collection to spicific numbers in laravel how to apply filter on laravel onfilter with were laravelreturn value map collection laravellaravel collection filter some columnsreturn 10 positions collection laravellaravel get all plucklaravel collect method in mapcollection function in laravelcollection example laravelcollection methdos laravellaravel instance as function for eachlaravel collection orderfilter laravel collectionlaravel collections mapslaravel filter functionlaravel return a collection with datalaravel collection has valuecara filter data laravellaravel collection filter by falselaravel merge collectionslaravel collection map with keyfilter eloquent collectionlaravel collection eloquentlaravel maplravel reducecollection methods in laravellaravel collection mapwithkeyscollection function sin laravellaravel model collection maplaravel items filterwhat is map in laravel collectionfilter 28 29 laravellaravel eloquent filter collection packagefilters value collection laravellaravel count collection itemsfilter collection in laravellaravel collection whereinlaravel filter 5blaravel collection excludecolection search by keylaravel collections filter bylaravel collections filter fieldslaravel filter methodlaravel collection map 3flaravel pluck exceptlaravel collection putlaravel array to collectionlaravel collection where betwneenlaravel pup from eloquent collectionpluck phpcollect laravellaravel reduce methodlaravel collection sort keys functionmap in collection laravellaravel controller filterlaravel infile filter collectionusing for laravel collectionpurpose of all method in laravel collectioncollection mapping laravelhow to create filter in laravel and uselaravel collection filter onelaravel take 5 from collectioncollection wherelaravel collection createeloquent containseloquent collection mapfilter data in laravelaravel collect map 22first 22filtering collections laravelin laravel collections what is the collect functionlaravel make collection from itemcollect function in laravellaravel where 3d filterlaravel map documetaitoncollection name laravelhow to create filter in laravellaravel filter from collectionlaravel com collectionlaravel collection values in bladeusing laravel collectionucword in laravel collection object how to make filter on created at in laravellaravel collection filter onlycollection laravel eachlaravel filter collection arraywhat is collections in laravellaravel filter listlaravel filter tutorialarray filter laravelbest way to make filter in laravel colection laravelcollection filter in laravelcollection object laravelcollection laravel methodscollection value laravelblade filtercollect function laravelhow to filter a collection in laravellaravel collectorlaravel collection libraryhow to make the filter in laravelmap in laravel collectionlaravel collectionfilter by valuelaravel collection plaincollection call in laravelwhat are collections laraveleach map collection laravellaravel collection helperphp artisan make 3afilter laravellaravel map methodsum of collection laravelget key on toarray method in laarevllaravel collection documentationcreate collection laravelfilter laravel examplelaravel basic collectionlaravel collection map functionlaravel collectionlaravel 7 filtertlaravel collection method of array collection methods laravlephp laravel filterlaravel collection filter by valuelaravel with filterlaravel filter wherelaravel filter collection and returncollection filter in laravel based in a keygetcollection laravelmake collection into single line in laravellaravel collection map custom methodlaravel filter get list collectionlaravel collection filterphp laravel collectionsfilter laravel alllaravel collection available methodscollect push laravellaravel collection counthow to use or in laravel collectionlaravel items filter examplelaravel collection array filterlaravel collection map or rejectlaravel get collection diferencefilter use in laravelfilter items in laravel collection with model functionscollection eloquent laravellarael pluck from array of collectionsphp collectlaravel is collectionlravel collection and maplaravel sum collectionlaravel collection functionslaravel commleection exampleslaravel 5 5 pluck arraycollect 28 29 in laravelcollection with laravellaravel collection docslaravel collection when methodmapping array collection laravellaravel get filterfilter collection by value laravellaravel map a collection in blade laravel mapwithkeys in arrayfilter in collection type row laravelcollection use in laravelfilter in laravel 8get collection from filter laravellaravel collection get by keyfilter data laravel examplefilter function in laravelwhay need laravel collectionlaravel create collection of objectslaravel define collectionfilterable laravellaravel collection get keyfilter function laravelhow to extract collection in laravellaravel collection array filterlaravel 7 api filter collectionlaravel collection filter itemslaravel collection filter getprepend laravelfilters in laravellaravel push item to collectionlaravel map collectionlaravel max list of 4 itemsfilter from collection laravellaravel map new objectlaravel collections method voidphp filter laravelwhat is filtering in laravellaravel 7 filter datalaravel collection reducelaravel collection map if variablelaravel blade collection filtermapwithkeys toarrayusing laravel filter 28 29laravel str collectionlaravel map eloquent collectionfilter in laravel bladeformat collection values laravellaravel paginate filterhow to make product collection in laravelcollection all in laravelcreate a new collection in map laravellaravel use filter for searchmap laravel collectionuse group instead of unique laravel collectionjs reduce in laravellaravel 8 filterfiltering operations on collections laravelhow to filter collection during query laravellaravel collection map functionswhat are collections in laravel objectlaravel collections map methodafter get colletion filter data laravlefilter on collection laravleeloquent 5ccollection laravellaravel collection 3efilterforeach is filtering some data laravel issuefirst from collection phplaravel filteruse laravel collection methodscollection eloquent filterfilter laravaellaravel collection call withget collection array keys laravelsortby in laravelfilter data laravelcollection method in laravel 8 is used forlaravel eloquent collection maplaravel implodemapping laravelcount laravel 7laravel collections explainedmake a collection in laravellaravel eloquent map collectionlaravel implement filterlaravel map on collectiontake method in laravel collectionlaravel collection in collectionlaravel get only values from collectionlaravel collection m c3 a9todos listaarray map collection laravellaravel is 28 29 collectioncollections method laravel 7laravel array map collectionlaravel collection filter fieldslaravel collection filter convert to arrayeloquent collection wherelaravel filter with resultseloquent 3efilter 28 29filter collection laravel c3 b1filter section in laravellaravel collection map is firstlaravel eloquent filtereloquent filter collectionlaravel pluck filterlaravel collection takelaravel allowed filters 28 29map function laraveleloquent insert into each resource in collectionduplicates laravellaravel reduce 28 29what is a collection in php laravellaravel map function collection keycollection laravel phpfilter with where laravellaravel collect function listlaravel filter query on collectionlaravel filter fun c3 a7 c3 a3o withfilter records from collection in laravellimit pluck laravellaravel containsfilter data from array in laravel collectionhow to apply filter in laravel 8laravel filter wherein querycollect map laravelhow to handle associative array in filter collection in laravelhow to fetch array in collect in laravel filtercollection filtertransform collection laravellaravel collection samplecolleciton filter laravelcollection in collection laravellaravel keybyuse group instead of unique laravelcollectionlaravel collection map in controllerwgat are laravel collections 3ereduce php laravellaravel define collection of a modelhow to filter in laravellaravel collection filter return truecollect laravel wherephp eloquent keybyhow to make filter in laravelphp laravel filter functionhow to filter collection laravelhow to create map in laravel 8filtering collection laravellaravel first from collectionquery filter method laravelcreate a filter laravellaravel array map collectionlaravel collection helperslaravel collections addeloquent collection methodslaravel collection filter with array keyslaravel collectionscollect 28 29 function laravellaravel collection mapbfilter inside filter laravellaravel collection filter by collectionslaravel where filterlaravel collection metodlaravel collect maplaravel filter collection inside collectionlaravel collection filter to arrayhow to filter with in laravecreate laravel collectionlaravel use collection aslaravel map to return a collectionlaravel collection map with keyslaravel collection replace keylaravel filter query on collectionfirst from collection laravellaravel collection array maplaravel collection or where methoddd products in laravellaravel with collectionlaravel collection where incollection laravel examplefilter in laravel querymap laravelfilter array laravelmap collections laravellaravel table with filterhow to value 5b 27 27 5d in filter in laravel collectlaravel collection get firstpluck to array in laravelcollect 28 40 laravellaravel collection 4laravel query filter laravle collectionslaravel collection map 28 29filter laravel valuescollection push laravel in map functionwhere in collection in laravelis laravel collection betterlaravel collection mapingmap in laraveluse array reduce in blade laravellaravel filter pagelaravel collection map function itsolutionphp laravel filter objectfilter data in laravellaravel collection helper methodslaravel grouping libraryavg laravel filter within a filter in laravelfilter array in laravelcollection in laravel 8laravel collection map to arrayfilter in model laravellaravel flatten collectionlaravel collection exampelshow to filter collection in laraellaravel filter request is returning 1laravel collection filter return arraywhat is a collection in laravellaravel array filterpluck 2b laravel documentation collect laravel whherelaravel collect reducelaravel eloquent map 28function 29filter laravel 7laravel collection map by keylaravel collectinlaravel collect method listlaravel filter on the collectionlaravel collect functionkey value map collection laravelselect product and make a collection in laravellaravel unique collection by keycollection methods laravelcollect filter laravelarray to laravel collectionhow to filter include in laravellaravel collection order by namesimple filter laraveleloquent filter laravellaravel pluck with arraymap collection in laravellaravel collection map iretationfilter values collect in the collection in laravelreduce function laravelcollection count laravelcollection map function laraveluse collection laravelfilter laravllaravel collection filter booleanhow to make a filter in laravellaravel collection uselaravel 8 filter collectionlaravlel collection mapcollection find laravelunderstanding collection in laraveluse map to laravel eloquentlaravel filter filterarray map laravellaravel pluck funtiongroupby and filter use in collection in laravel collectlaravel collections and the collect methodlaravel collection map keyslaravel take on collectionslaravel create collection objectlaravel filter dataeloquent map collectionhow to filter data in laravellaravel blade filterall 28 29 3efilter 28function laravelarray filter in lravel phphow to filter collection in laravellaravel collection map get keycollection length laravellaravel get map functioncollection where function laravellaravel collection replace keyscollection method in laravellaravel select parameters collectlaravel count elements in collectionlaravel merge datas form same collectionslaravel collection map wherelaravel collection withhow to include duplicates collection method in laravel 5 7using array methods on laravel collectionscollection given laravellaravel collection filter get datahow to map collection in laravellaravel filtering resultshow to make filter in laravel using phplaravel map each in a collectionlaravel collection filter or wherelaravel divide collection equalslaravel call a filterlaravel collection map and rejectfilter laravel collection by fieldlaravel mapping collectionlaravel 6 map array of array request into classlaravel mapwithkeysphp filteration laravel 8eloquent collection laravelreduce function in laravelcollection methods in laravel 8 xcollection 28 29 3eobject laravellaravel map function uselaravel collection filter arraylaravel collection methods mapfiltering in laravellaravel define a collectionarray filter laravel collectionhow to use laravel collectionlaravel filter collectionreduce function 2blravellaravel 8 collection methodlaravel eloquent collection methodsmapping collection laravellaravel javascript filterlaravel collection to arrayfilter laravel bfilterwork with a collection laravel laravel com 7c 7c collectionlaravel filter firstlaravel collection listlaravel filter collection with conditionlaravel pulinglaravel make 3afilterarray to collection laravelcollection laravel onlyhow to use filter collection laravellaravel collection classlaravel collection objectlaravel filter collection and return value onlylaravel collection without valuelaravel collect map functionlaravel collect and maplaravel collection maplaravel duplicatestoarray 28 29 laravellaravel collection in detailslaravel get counter on filter 28 29 callbackcollections laravelwhere laravel filterlaravel eloquent collection map methodsmap collection laravelcollection eloquent methodscollect 28 29 3emapwithkeys 28 29 laravellaravel using the map methodlaravel 7 filter collectioncollection array map laravellaravel collection optionsfilter laravel collectiomlaravel 3efilterhow make collection in laravellaravel collection splithow to use collection in laravellaravel model collection map helper examplelaravel sortbylaravel eloquent collection filterget all from collection laravlefilter functionality in laravelusers collection filter in laravellaravel collection class samplelaravel collect filterlaravel end not working for collectionclass collection laraveluse collection in laravelcollection map in laravelhow we filter the collection after get method in laravellaravel each collectioncollection 3amake laravellaravel collection 28 29string filter function in laravellaravel use collectionhow to use collection in laravel to filterclass collection in laravellaravel collection filter by columnshow to filter model collection in laravellaravel collection implodelaravel collection get values by keymap in quere laravel collectionlaravel except collection with conditionlaravel eloquent filter collectionlaravel 7 access collextionlaravel collection map returncollection laravel eloquentlaravel collection filter eloquentmap in collection inside of a variable laravellaravel map collection key valuelaravel collection filter wherecollection in laravellaravel collections mapmap a collection use laravelcollection filter method laraveladd to collection laravellaravel collection to array filterusers collection map in laravelcollection where in laravelfilter in laravel collectionlaravel collection filter 1 foreach grouphow to check all elements exist in array using array map in laravelwhen to use laravel collectionmap value of object collection laravelusing reduce laravellaravel collect creating limit 10laravel filteringexplode eloquent collectiopluck laravelfilter model laravellaravel filter collection from datalaravel collection filter by value laracastlaravel collection for laravel 6laravel when collectionhow to implement filter in laravellaravel map collection to arraylaravel collection map eachphp collectionsmap coolection using use laravelarray merge to collection in laravellaravel collection filter by keysort by laravel 8filter collecton laravellaravel reducelaravel filter collectinlaravel collection functiojnslaravel collection of collectionslaravel collection filter return collectioncollection reduce laravel 3a 3acollection in laravelfiltering laraveleloquent collection filterlaravel collection eloquent filter map collection make items array in laravelfilter laravel collection in bladefilter where array collection laravellaravel 8 map objectuse collection 2b laravelwahts a collection laravelpluck vs collect laravellaravel collections methodslaravel filter callbacklaravel collection filter objectadd filter in laravelcollection map return string laravellaravel map functionlaravel filter eloquent collectionlaravel filter in bladesimple laravel filtercollection filterlaravel collection allhow to use a filter function in laravelcollection filter in callback in laravellaravel collection of object filterlaravel get values from collectionlaravel 8 function filterassociative collection to collection php laravellaravel pluck to arraylaravel eloquent collection to arraycollection take laravelarray filter in laravelcollection laravel filteruse filter in laravellaravel collection wherelaravel get returns collectioncollection php laravelcollection mapping in laravellaravel collection methodcollection function laravellaravel collection to associative array define keyfilter a collection in laravellaravel is collectionlaravel map with class methodreturn in lazy collections laravellaravel filter in modellaravel collection array map collection laravelcollection laravelcollection method laravelfilter laravel phporder by collection laravelcollections laravel filterlaravel filter examplelaravel collection where defaultlaravel pluck functionlaravel map a colectionfilter laravel 8laravel map systemcollect data where type in laravellaravel collection infilter in laravelfilter laravel collection in frontendlaravel reduce functionlaravel collection 3emapcollection map with keys laravellaravel values 28 29select from laravel collectionlaravel collection map with parametersmap over laravel collection and return valuefilter for value in laravel collectionlaravel collect fuctionwhat is collection of laravelcollection metod in laravelfilter i laravelcollection in laravel examplewhat is collect 28 29 in laravelcollection methods php laravelphp laravel get collection sizelaravel useful collection methodsexample laravel filter with javascriptwhat is collection in laravellaravel flatten arraylaravel collection maofilter laravellaravel best way to filtercollection class in laravel 8split obj by key value equivalent in laravellaravel collection methofdlaravel docs collectionarray filter laravelaravel splicelaravel collection filter part of valuelaravel collection map indeximplode laravelhow to chenk collection in laravel 3 3 2 3larvel reducemap to collections laravellaravel collection flattenlaravel collection helper maplaravel collection only methodlaravel collection map get objectfilter function 2blravelmapping array laravellaravel laravel collectionfilter illuminate collectionlaravel replace item in collection laravellaravel collectionmapfilter laravel eloquentlaravel collection methodslaravel php filterlaravel eloquent 5c 5ccollectionadd key and value in first collection in multidimensional collection using map laravellaravel collection in stdclasslaravel manage doublons on collectionlaravel is in collectionpluck method with toarray method laravelfiltro collection laravellaravel collapse belongstogrand total laravel collectionlaravel collection arraylaravel 8 laravel collectionlaravel 5 collectionwhere filter laravelcollections in laravelreducer in laravellaravel check collection memmory sizwlaravel using the filter methodmake a new collection after filtering a collection in laravelwhat is collect function laravelfilter array in php laravellaravel function collectlaravel collection filter with collectionlaravel collections map to arraylaravel collection methofslaravel add to collectionlaravel filter modelfilter in laravel arraylaravel plucjkfilter collection transformation laravellaravel collection whenis filter in laravelwith filter laravelfilter a collection laravellaravel collection and filtersimply array of array laravellaravel collect map key valuecollect method laravellaravel collectiohow we filter the collection in laravelhow to use laravel filtercollection define in php laravel laravel filter querywhat is use for in laravel collectionwhere in laravel collection collectionwhat is a laravel collectionbest way to make filter in laravel 8map in builder 3a 3amap 28 29 laravel collectioneloquent collection methods mapwhat is collection laravellaravle filterlaravel collection map on userscollection wherehow to use only methode on collection in eloquentlaravel get collectionwith method with collection laraveluse where with filter in laraveldefine collection laravellaravel collection phpfiltering data in laravellaravel collecion methodslravel filter methodany 28 29 on array c3 a7arave c3 a7implode array laravellaravel collecfilter on collection laravellaravel split collection by valuehow to apply filters on collection laravelcollection push field laravellaravel unique collectionmap from collection laravelget values by key in collection laravelcollection take method laravelfilters php laravellaravel elequent filterlaravel collection keybylaravel filter by categorylaravel array mapeloquent collection to arraylaravel collection metodoslaravel collection find indexlaravel collect 28filter from string in laravellaravel 6 map collectionlaravel what is a collectionlaravel collection examplehandle filter laravellaravel collection 27eleqont collection filterhow to set filter in laravellaravel colelction mapto gather elements together and add them together eloquentllaravel collection getmap and filter return full array in laraveleloquent collection functionslaravel collection map with methodlaravel filter table mysqldefine collection in laravelsortby laravellaravel filter 3a 3awhat is collection filter laravellaravel map with uselaravel map collection examplearray sum laravel apicollection map function return specific value laravellaravel filter resultswhere in collection laravellaravel collection filter keyslaravel collectionfilterarray slice alravelfilter 28 29 in crawler in laravellaravel result collectionlarvel collectionslaravel collection make new collection in mapcollection php laravel mapfilter in collection laraveliwatch laravellaravel collect 28 29laravel filter arraywhat are collections in laravellaravel filter libraryuse in filter laravelusing map in collection laravellaravel collection filter by keyssortby collection laravelfilter collection laraelaravel framework collectionarray sum in laravel collectionlaravel collectionlaravel prependhow can filter in laravelcollect in laravelcoleection laravellaravel collection oplaravel counter on filter 28 29 callbacklaravel collection spread operatorlaravel create collectionlaravel collection get on keyphp array to collection laravelhow to access the key in collection laravellaravel filter functionalitylaravel filter collection bylaravel eloquent collectionreduce in laravel collectionlaravel filter valuessecond iteration makes other format in array laravelmap return new laravel collectionlaravel collection 3epush with keyusing filter in laravel querylaravel filter collection and create arraycollection map laravel using idmap on collection in laravellaravel collection objectswhat is laravel collectionlaravel collection filter functionlaravel collection pick positionuse of collection in laravelcollection start from laravellaravel collection filter with arrayilluminate collection filterexcept 28 29 laravellaravel blade filter laravel collectionlaravel 6 map array of array in request into classlaravel collection fileterhow we use filter in laravelhow to filter big collection in laravelcollection map laravelcollection filter laravellaravel collection flat related filtering data in laravel collection using vuelaravel collection map key itemfilter data in laravel examplelaravel create new array from filter collectionlaravel filter javascripthow to filter laravel collectionarray map use collection laravelmap 28 29 laravelfilter collection for cols eloquentcollect for laravel collectionslaravel convert collection to associative array and filterlaravel collection map with iterationshow to search on collection and sum if case phpmaking a collection in laravellaravel collection methods containcreate a new collections in map laravellaravel collection filter examplelaravel collectiooncollection laravel mapreduce laravellaravel in collectionlaravel 6 collectionlaravel model collectionfilter collection from array laravellaravel filter on collectionlaravel sortmap array data to collection object in laravellaravel collection maplaravel combine collectionswhy needed laravel collectioncollect 28 29 laravelcollection laravel functionslaravel collection of objectscollection functions laravellaravel filterscollections laravel methodslaravel format collection valuelaravel colletionlaravel 6 map value from array request into classhow to use filter in laravelcollection methods l c3 a7aravellaravel collections groupbya collection of laravellaravel map arraylaravel create array from collectionfilter string laravellaravel filter collection of modelsfilter array php laravellaravel collection columnlaravel how to filter dictionarylaravel 7 filter functionwhat is collections in laravel 3ffilter data laravaelcollection of collection laravellaravel collection filter