Laravel's real-time facades feel like magic - in the best possible way. You try it out, it works, and you think to yourself, "Huh...how on earth did they do that?" Well, I'll show you exactly how it works. We'll even make our own custom facade generator for learning purposes.
PHP generators can be confusing to understand. Why and when would I reach for them? The easiest answer to this question is when you're working with very large datasets. A generator allows us to circumvent memory limit concerns by iterating over data without first building up a large array in memory.
As of Laravel 6, generators are now used when lazy-loading collections.
*Series still in development. Check back often for updates.