๐Ÿ”ฅ Weekly thread #10 of 2022

๐Ÿ”ฅ This week's code tips for Laravel developers

A weekly thread ๐Ÿงต

You can convert an Eloquent collection back to an Eloquent Query builder

3

๐Ÿ”ฅ You can convert an Eloquent collection back to an Eloquent Query builder

You can convert an Eloquent collection back to an Eloquent Query builder

#Laravel Tip ๐Ÿ”ฅ : In some situation you might want to update all the models inside the eloquent collection. You can do that easily in Laravel using toQuery() method. Laravel is utilizing #PHP like a pro. See how can you do that ๐Ÿ‘‡

#webdevelopers #100DaysOfCode #developers

RateLimiter's attempt() accepts a fourth parameter for the "decay"

2

๐Ÿ”ฅ RateLimiter's attempt() accepts a fourth parameter for the "decay"

RateLimiter's attempt() accepts a fourth parameter for the "decay"

๐Ÿ’ก The 'attempt()' method of the RateLimiter that comes with @laravelphp has an optional fourth argument to specify the decay.

Both examples dispatch max 12 events per minute, but the latter spread the events throughout the minute. Incredible, isn't it? ๐Ÿคฉ

#Laravel #PHP #webdev

The order of columns in multi-column indices matters

1

๐Ÿ”ฅ The order of columns in multi-column indices matters

The order of columns in multi-column indices matters

โšก๏ธ Database Tip

Creating indexes is a handcraft learned from experience, multiple-column indexes is a lot more complicated. But it doesn't have to be complicated!

Here are 3 simple rules for the column ordering of multiple column indexes, solving 80% of the perf problems.

We're writing a book, you can get it for free here.