1$artist = 'Vincent John Doe';
2
3// you can filter the collection and keep only those items
4// that pass a given truth test:
5$art_collection = $paintings->filter(function ($painting) use ($artist) {
6 return $painting->artist == $artist;
7});
8
9// you can also do a foreach
10foreach($paintings as $painting) {
11 if($painting->artist == $artist) {
12 $art_collection[] = $painting;
13 }
14}