1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 05:14:04 +00:00

Change 2021-01 to 2021-50 (Weekly thread #50)

This commit is contained in:
lukinovec 2022-01-07 18:35:45 +01:00
parent 93b528cb9f
commit 57b4925e7b
7 changed files with 15 additions and 15 deletions

View file

@ -1,6 +1,6 @@
---
slug: weekly-thread-2021-01
title: 'Weekly thread #01 of 2021'
slug: weekly-thread-2021-50
title: 'Weekly thread #50 of 2021'
tweet_id: '1471864631312404492'
author_username: archtechx
created_at: 2022-01-07T12:56:47+00:00
@ -8,4 +8,4 @@ links: { }
---
🔥 This week's code tips for Laravel developers
A weekly thread 🧵
A weekly thread 🧵

View file

@ -1,7 +1,7 @@
---
title: 'Adding WHERE scopes which use an indexed column to a query that''s primarily filtered by another column is a great way to speed up DB performance'
tweet_id: '1471864653491974151'
thread_slug: weekly-thread-2021-01
thread_slug: weekly-thread-2021-50
author_username: tobias_petry
images:
- 'https://pbs.twimg.com/media/FGafd_JXMAEDgP5.jpg'
@ -10,4 +10,4 @@ slug: adding-where-scopes-which-use-an-indexed-column-to-a-query-thats-primarily
---
⚡️ Database Tip
Sometimes you have seldom used queries and you can't add an index on columns for these queries. A nice trick is to use another indexed condition so the rows are filtered by the indexable column first and afterwards again for the more limiting condition.
Sometimes you have seldom used queries and you can't add an index on columns for these queries. A nice trick is to use another indexed condition so the rows are filtered by the indexable column first and afterwards again for the more limiting condition.

View file

@ -1,13 +1,13 @@
---
title: 'Use match () or switch () statements to conditionally scope database queries based on query strings in the request'
tweet_id: '1471864655710670854'
thread_slug: weekly-thread-2021-01
thread_slug: weekly-thread-2021-50
author_username: archtechx
images:
- 'https://pbs.twimg.com/media/FGmQH5nXEAs4mnv.jpg'
created_at: 2021-12-17T15:27:34+00:00
slug: use-match-or-switch-statements-to-conditionally-scope-database-queries-based-on-query-strings-in-the-request
---
Remembered this great tip recently, and it's nice to see how fast PHP evolves
Remembered this great tip recently, and it's nice to see how fast PHP evolves
The exact same behavior can be implemented using match () with a default value, which also removes the need for the second callback ⚡️ https://twitter.com/reinink/status/1233017064492761088
The exact same behavior can be implemented using match () with a default value, which also removes the need for the second callback ⚡️ https://twitter.com/reinink/status/1233017064492761088

View file

@ -1,7 +1,7 @@
---
title: 'Use retry() for callbacks that may randomly fail'
tweet_id: '1471864638199451648'
thread_slug: weekly-thread-2021-01
thread_slug: weekly-thread-2021-50
author_username: alexjgarrett
images:
- 'https://pbs.twimg.com/media/FGP3MSQWQAYKjSm.jpg'
@ -12,4 +12,4 @@ slug: use-retry-for-callbacks-that-may-randomly-fail
I was hitting a shaky API that sometimes failed.
Here, the retry function tries the callback 3 times, with a 2 second interval in-between retries.
Here, the retry function tries the callback 3 times, with a 2 second interval in-between retries.

View file

@ -1,7 +1,7 @@
---
title: 'You can add a --refresh flag to the artisan down command to send a refresh header to the browser'
tweet_id: '1471864676652826626'
thread_slug: weekly-thread-2021-01
thread_slug: weekly-thread-2021-50
author_username: DianaWebdev
images:
- 'https://pbs.twimg.com/media/FG0dHeBXwAw3bvc.jpg'

View file

@ -1,7 +1,7 @@
---
title: 'You can refactor cluttered if () conditions using lookup tables, match statements, and switch statements'
tweet_id: '1471864664661311488'
thread_slug: weekly-thread-2021-01
thread_slug: weekly-thread-2021-50
author_username: archtechx
images:
- 'https://pbs.twimg.com/media/FGVrAKdVgAIWfwk.jpg'
@ -12,4 +12,4 @@ slug: you-can-refactor-cluttered-if-conditions-using-lookup-tables-match-stateme
First: lookup tables 👇
These are great for refactoring complex conditions with lots of else if () cases
These are great for refactoring complex conditions with lots of else if () cases

View file

@ -1,7 +1,7 @@
---
title: 'You can use the array spread syntax to pass an array of arguments to another function'
tweet_id: '1471864644562305025'
thread_slug: weekly-thread-2021-01
thread_slug: weekly-thread-2021-50
author_username: freekmurze
images:
- 'https://pbs.twimg.com/media/FGepj8mWQAUf2R_.jpg'
@ -14,4 +14,4 @@ Heres a self-contained example where we spread the array output of sys_getloa
https://github.com/spatie/cpu-load-health-check/blob/70f387d5167c24d4000d825a5bddab2504d557fb/src/CpuLoad.php#L17
#php
#php