MrPunyapal
MrPunyapal

Punyapal Shah

Verified

@MrPunyapal

Laravel Artisan, PHP dev, Consultant, Speaker, opensource contributor, Part of @LaravelArtisans , @LaravelAhm , Core @Pinkary , @pestphp , YouTuber.
2K Posts 20K Views
  • No matching results...
  • Searching...

/ 255

Most Laravel developers know pipe().

Far fewer know about pipeThrough().

Instead of one transformation, you can pass your collection through multiple reusable callables, keeping each step small, focused, and easy to test.

Have you ever used it?
image

Developers, do you know how many open-source projects you have contributed to?

Mine is 100+, I guess.

How to find? Ask your AI to find it via `gh` (GitHub CLI).
image

40

Laravel developers, are you filtering the same collection twice?

If you need both the matching and non-matching items, partition() does it in a single call.

Bonus: it even supports higher-order messages. 👀
image

48

Laravel developers, ever wanted pluck()-like output with more than one column?

pluck() is intentionally designed for a single value.

Instead, retrieve only the columns you need and use map->only().

Need the collection keyed by id? mapWithKeys() does the trick.
image

47