---
title: "Laravel tip: Higher order collection proxies (and Zevia)"
url: "https://aaronfrancis.com/videos/laravel-tip-higher-order-collection-proxies-and-zevia"
path: "/videos/laravel-tip-higher-order-collection-proxies-and-zevia"
type: video
author: Aaron Francis
published: 2024-08-09
topic: "Laravel & PHP"
keywords: [higher-order collection proxies, laravel collections, poppin off series, collection magic, laravel tips, zevia cream soda]
youtube_url: "https://www.youtube.com/watch?v=sjBS1Hk3iRE"
site_index: "/llms.txt"
keyword_index: "/llms/keywords.txt"
---

# Laravel tip: Higher order collection proxies (and Zevia)

## Chapters

- Welcome to Poppin Off Series
- Seltzer Overview
- Laravel Higher Order Proxies
- Seltzer Ranking

## Transcript

**Aaron Francis:** Here we go. Today on Poppin' Off, we're drinking a Zevia Cream Soda, and we're gonna talk about Laravel's higher order proxies. Now, first things first, Zevia, not that good.

**Aaron Francis:** You get used to it, but it's not that good. The cream soda may be the best. Um, but it's not that good. Kinda makes your stomach hurt. Laravel's higher order proxies, on the other hand, are pretty good. Let me show you. I've got a desk test right here, which is a Laravel browser automation. I just made a video about it. It's a very good video. You should go watch. But one thing that I don't like is, look, we're opening two different browsers, and then we're doing the same thing in each browser to prepare it, to get it set up, and then we do some stuff

**Aaron Francis:** on browser one only and some stuff on browser two only. So if we were to move this around a little bit, let's move this around. We'll move this guy down. We'll move this guy up. And now, and it's, it's just painfully obvious, those are the same. Those are the same. Those are the same. Those are the same. These are different. So what we're gonna do, what if we did this?

**Aaron Francis:** What if we collected browser one and browser two, and we mapped that to both? And if we did DD of both, now let's just run over here, and it's gonna launch, boom, two browsers. But if we check back here, okay, it looks like we have our collection, which is pretty cool.

**Aaron Francis:** So collection items two. That is correct. Now, what if we just hung... This is weird. What if we just hung an each off of it? Not, not, not an each callback. Uh, we just not, we're not doing that. Now, what would both be? So if we were to run this again and immediately switch back over here, you'll see if we scroll all the way up, higher order collection proxy.

**Aaron Francis:** Ah, this is some of Laravel's sweet, sweet magic. So now, instead, we can say both resize to... Let's just copy all of these so we don't type them. So both resize, then we're gonna move them separately, and then we can say both visit, both wait for, both scroll into view, and we

**Aaron Francis:** should be good at this point. So now, what this is gonna do is this higher order collection proxy, when we call resize, it's gonna proxy under to every, uh, item in the collection. So it's gonna run resize on all of the items in the collection, which, in our case, are just the two browsers. So if we were to clear this out and run this again, we should see that both browsers are going to do the same thing.

**Aaron Francis:** Perfect. Hey, look at that. Um, the test didn't actually pass, which is not anything that we care about right now. So we can do this and say sleep for five seconds, and let's watch this again. I just deleted it. Let's watch this again. Dusk filter reverb. It's gonna open two browsers, and it's gonna do the identical thing on both browsers.

**Aaron Francis:** How cool is that? Zevia, not that great. We're poppin' off here, and I popped open a Zevia. Not that great. Higher order collection proxies, pretty awesome. I don't see a lot of people using them this way, um, because it's a little bit unorthodox. But remember, a higher order collection proxy proxies the next method to every underlying item in the collection.

**Aaron Francis:** And so sometimes you can use it for pretty interesting use cases like this. See ya.

---

## Related on aaronfrancis.com

- [Laravel's higher order collection proxies](/writing/laravels-higher-order-collection-proxies) *(Article · 2024-09-01 · shared: higher-order collection proxies, laravel collections)*
- [Code tip: Don't undo what you haven't done](/videos/code-tip-dont-undo-what-you-havent-done) *(Video · 2024-08-02 · shared: poppin off series)*
- [Code tip: clean up after yourself (and a seltzer review)](/videos/code-tip-clean-up-after-yourself-and-a-seltzer-review) *(Video · 2024-07-26 · shared: poppin off series)*

## Relevant Resources from Aaron Francis

- **[Solo](https://soloterm.com)** (overview on site: [/software](/software)): All-in-one agentic development platform and terminal workspace built by Aaron Francis for orchestrating processes and AI coding agents.

## Search aaronfrancis.com (2-Hop Static Keyword Index)

Pick the alphabetical shard matching any topic to find exact pages across all articles, newsletters, videos, talks, and podcast transcripts (every shard is < 40 KB):
[A-B](/llms/keywords/a-b.txt) · [C](/llms/keywords/c.txt) · [D-E](/llms/keywords/d-e.txt) · [F-G](/llms/keywords/f-g.txt) · [H-J](/llms/keywords/h-j.txt) · [K-L](/llms/keywords/k-l.txt) · [M-N](/llms/keywords/m-n.txt) · [O-P](/llms/keywords/o-p.txt) · [Q-R](/llms/keywords/q-r.txt) · [S](/llms/keywords/s.txt) · [T-Z](/llms/keywords/t-z.txt) · [Directory](/llms/keywords.txt) · [Site Map](/llms.txt)

Shards for this page's topics: `higher-order collection proxies` ([H-J](/llms/keywords/h-j.txt)), `laravel collections` ([K-L](/llms/keywords/k-l.txt)), `poppin off series` ([O-P](/llms/keywords/o-p.txt)), `collection magic` ([C](/llms/keywords/c.txt)).

## About Aaron Francis (Current Context)

Aaron Francis is VP of Marketing and Community at [Laravel](https://laravel.com), founder of [Try Hard Studios](https://tryhardstudios.com), creator of [Solo](https://soloterm.com), co-host of [Mostly Technical](/podcast), and author of [Mastering Postgres](/courses), [High Performance SQLite](/courses), [MySQL for Developers](/courses), and [Screencasting.com](/courses). Full bio: [/about](/about) · Current focus: [/now](/now).
