mirror of
https://github.com/archtechx/laravel-tips.git
synced 2025-12-11 21:14:02 +00:00
Week 10
This commit is contained in:
parent
fdd9549f41
commit
4af817e2b0
6 changed files with 73 additions and 0 deletions
5
content/authors/iamharis010.md
Normal file
5
content/authors/iamharis010.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
username: iamharis010
|
||||
name: 'Mohammad Haris ⚡'
|
||||
avatar: 'https://pbs.twimg.com/profile_images/1491541849198133248/WLgcha1__normal.jpg'
|
||||
---
|
||||
11
content/threads/weekly-thread-2022-10.md
Normal file
11
content/threads/weekly-thread-2022-10.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
slug: weekly-thread-2022-10
|
||||
title: 'Weekly thread #10 of 2022'
|
||||
tweet_id: '1502367760927625219'
|
||||
author_username: archtechx
|
||||
created_at: 2022-03-11T19:36:01+00:00
|
||||
links: { }
|
||||
---
|
||||
🔥 This week's code tips for Laravel developers
|
||||
|
||||
A weekly thread 🧵
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
title: 'RateLimiter''s attempt() accepts a fourth parameter for the "decay"'
|
||||
tweet_id: '1502367770226294785'
|
||||
thread_slug: weekly-thread-2022-10
|
||||
author_username: pascalbaljet
|
||||
images:
|
||||
- 'https://pbs.twimg.com/media/FNZv2KJXsAceOtF.jpg'
|
||||
created_at: 2022-03-11T19:36:03+00:00
|
||||
slug: ratelimiters-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
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
title: 'The order of columns in multi-column indices matters'
|
||||
tweet_id: '1502367764119314433'
|
||||
thread_slug: weekly-thread-2022-10
|
||||
author_username: tobias_petry
|
||||
images:
|
||||
- 'https://pbs.twimg.com/media/FNZ80F6XMAcIeTt.jpg'
|
||||
created_at: 2022-03-11T19:36:02+00:00
|
||||
slug: 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.
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
title: 'Use the $touches property to update the parent timestamp when a child is updated'
|
||||
tweet_id: '1502367773288468480'
|
||||
thread_slug: weekly-thread-2022-10
|
||||
author_username: cosmeescobedo
|
||||
images:
|
||||
- 'https://pbs.twimg.com/media/FNDZSoCUYAYIRo_.jpg'
|
||||
created_at: 2022-03-11T19:36:04+00:00
|
||||
slug: use-the-touches-property-to-update-the-parent-timestamp-when-a-child-is-updated
|
||||
---
|
||||
🔥 #Laravel Did you know you can update the parent model timestamp when a child is updated?
|
||||
|
||||
If you have a "belongsTo" or "belongsToMany" relationship you can define a "$touches" property to do this.
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
title: 'You can convert an Eloquent collection back to an Eloquent Query builder'
|
||||
tweet_id: '1502367767231537152'
|
||||
thread_slug: weekly-thread-2022-10
|
||||
author_username: iamharis010
|
||||
images:
|
||||
- 'https://pbs.twimg.com/media/FNYYjjNVkAIEwQW.jpg'
|
||||
created_at: 2022-03-11T19:36:03+00:00
|
||||
slug: 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue