From 4af817e2b02d29302672ab314b8160120e5757c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sat, 12 Mar 2022 23:01:24 +0100 Subject: [PATCH] Week 10 --- content/authors/iamharis010.md | 5 +++++ content/threads/weekly-thread-2022-10.md | 11 +++++++++++ ...pt-accepts-a-fourth-parameter-for-the-decay.md | 15 +++++++++++++++ ...-of-columns-in-multi-column-indices-matters.md | 15 +++++++++++++++ ...he-parent-timestamp-when-a-child-is-updated.md | 13 +++++++++++++ ...ollection-back-to-an-eloquent-query-builder.md | 14 ++++++++++++++ 6 files changed, 73 insertions(+) create mode 100644 content/authors/iamharis010.md create mode 100644 content/threads/weekly-thread-2022-10.md create mode 100644 content/tips/ratelimiters-attempt-accepts-a-fourth-parameter-for-the-decay.md create mode 100644 content/tips/the-order-of-columns-in-multi-column-indices-matters.md create mode 100644 content/tips/use-the-touches-property-to-update-the-parent-timestamp-when-a-child-is-updated.md create mode 100644 content/tips/you-can-convert-an-eloquent-collection-back-to-an-eloquent-query-builder.md diff --git a/content/authors/iamharis010.md b/content/authors/iamharis010.md new file mode 100644 index 0000000..a86c9cc --- /dev/null +++ b/content/authors/iamharis010.md @@ -0,0 +1,5 @@ +--- +username: iamharis010 +name: 'Mohammad Haris โšก' +avatar: 'https://pbs.twimg.com/profile_images/1491541849198133248/WLgcha1__normal.jpg' +--- diff --git a/content/threads/weekly-thread-2022-10.md b/content/threads/weekly-thread-2022-10.md new file mode 100644 index 0000000..cc13548 --- /dev/null +++ b/content/threads/weekly-thread-2022-10.md @@ -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 ๐Ÿงต \ No newline at end of file diff --git a/content/tips/ratelimiters-attempt-accepts-a-fourth-parameter-for-the-decay.md b/content/tips/ratelimiters-attempt-accepts-a-fourth-parameter-for-the-decay.md new file mode 100644 index 0000000..e2f1ccc --- /dev/null +++ b/content/tips/ratelimiters-attempt-accepts-a-fourth-parameter-for-the-decay.md @@ -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 \ No newline at end of file diff --git a/content/tips/the-order-of-columns-in-multi-column-indices-matters.md b/content/tips/the-order-of-columns-in-multi-column-indices-matters.md new file mode 100644 index 0000000..6fb591d --- /dev/null +++ b/content/tips/the-order-of-columns-in-multi-column-indices-matters.md @@ -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. \ No newline at end of file diff --git a/content/tips/use-the-touches-property-to-update-the-parent-timestamp-when-a-child-is-updated.md b/content/tips/use-the-touches-property-to-update-the-parent-timestamp-when-a-child-is-updated.md new file mode 100644 index 0000000..3d4dd03 --- /dev/null +++ b/content/tips/use-the-touches-property-to-update-the-parent-timestamp-when-a-child-is-updated.md @@ -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. \ No newline at end of file diff --git a/content/tips/you-can-convert-an-eloquent-collection-back-to-an-eloquent-query-builder.md b/content/tips/you-can-convert-an-eloquent-collection-back-to-an-eloquent-query-builder.md new file mode 100644 index 0000000..a8dac67 --- /dev/null +++ b/content/tips/you-can-convert-an-eloquent-collection-back-to-an-eloquent-query-builder.md @@ -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 \ No newline at end of file