mirror of
https://github.com/archtechx/laravel-tips.git
synced 2025-12-12 05:14:04 +00:00
Merge branch 'master' of https://github.com/archtechx/laravel-tips into week-51
This commit is contained in:
commit
54106ee7d8
8 changed files with 23 additions and 23 deletions
|
|
@ -1,11 +0,0 @@
|
||||||
---
|
|
||||||
slug: weekly-thread-2021-01
|
|
||||||
title: 'Weekly thread #01 of 2022'
|
|
||||||
tweet_id: '1479467928818892800'
|
|
||||||
author_username: archtechx
|
|
||||||
created_at: 2022-01-07T16:35:34+00:00
|
|
||||||
links: { }
|
|
||||||
---
|
|
||||||
🔥 Latest code tips for Laravel developers
|
|
||||||
|
|
||||||
First week's special: news from the past 3 weeks 🧵
|
|
||||||
11
content/threads/weekly-thread-2021-50.md
Normal file
11
content/threads/weekly-thread-2021-50.md
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
slug: weekly-thread-2021-50
|
||||||
|
title: 'Weekly thread #50 of 2021'
|
||||||
|
tweet_id: '1471864631312404492'
|
||||||
|
author_username: archtechx
|
||||||
|
created_at: 2022-01-07T16:35:34+00:00
|
||||||
|
links: { }
|
||||||
|
---
|
||||||
|
🔥 Latest code tips for Laravel developers
|
||||||
|
|
||||||
|
A weekly thread 🧵
|
||||||
|
|
@ -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'
|
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'
|
tweet_id: '1471864653491974151'
|
||||||
thread_slug: weekly-thread-2021-01
|
thread_slug: weekly-thread-2021-50
|
||||||
author_username: tobias_petry
|
author_username: tobias_petry
|
||||||
images:
|
images:
|
||||||
- 'https://pbs.twimg.com/media/FGafd_JXMAEDgP5.jpg'
|
- '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
|
⚡️ 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.
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
---
|
---
|
||||||
title: 'Use match () or switch () statements to conditionally scope database queries based on query strings in the request'
|
title: 'Use match () or switch () statements to conditionally scope database queries based on query strings in the request'
|
||||||
tweet_id: '1471864655710670854'
|
tweet_id: '1471864655710670854'
|
||||||
thread_slug: weekly-thread-2021-01
|
thread_slug: weekly-thread-2021-50
|
||||||
author_username: archtechx
|
author_username: archtechx
|
||||||
images:
|
images:
|
||||||
- 'https://pbs.twimg.com/media/FGmQH5nXEAs4mnv.jpg'
|
- 'https://pbs.twimg.com/media/FGmQH5nXEAs4mnv.jpg'
|
||||||
created_at: 2021-12-17T15:27:34+00:00
|
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
|
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
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
title: 'Use retry() for callbacks that may randomly fail'
|
title: 'Use retry() for callbacks that may randomly fail'
|
||||||
tweet_id: '1471864638199451648'
|
tweet_id: '1471864638199451648'
|
||||||
thread_slug: weekly-thread-2021-01
|
thread_slug: weekly-thread-2021-50
|
||||||
author_username: alexjgarrett
|
author_username: alexjgarrett
|
||||||
images:
|
images:
|
||||||
- 'https://pbs.twimg.com/media/FGP3MSQWQAYKjSm.jpg'
|
- '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.
|
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.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
title: 'You can add a --refresh flag to the artisan down command to send a refresh header to the browser'
|
title: 'You can add a --refresh flag to the artisan down command to send a refresh header to the browser'
|
||||||
tweet_id: '1471864676652826626'
|
tweet_id: '1471864676652826626'
|
||||||
thread_slug: weekly-thread-2021-01
|
thread_slug: weekly-thread-2021-50
|
||||||
author_username: DianaWebdev
|
author_username: DianaWebdev
|
||||||
images:
|
images:
|
||||||
- 'https://pbs.twimg.com/media/FG0dHeBXwAw3bvc.jpg'
|
- 'https://pbs.twimg.com/media/FG0dHeBXwAw3bvc.jpg'
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
title: 'You can refactor cluttered if () conditions using lookup tables, match statements, and switch statements'
|
title: 'You can refactor cluttered if () conditions using lookup tables, match statements, and switch statements'
|
||||||
tweet_id: '1471864664661311488'
|
tweet_id: '1471864664661311488'
|
||||||
thread_slug: weekly-thread-2021-01
|
thread_slug: weekly-thread-2021-50
|
||||||
author_username: archtechx
|
author_username: archtechx
|
||||||
images:
|
images:
|
||||||
- 'https://pbs.twimg.com/media/FGVrAKdVgAIWfwk.jpg'
|
- '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 👇
|
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
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
title: 'You can use the array spread syntax to pass an array of arguments to another function'
|
title: 'You can use the array spread syntax to pass an array of arguments to another function'
|
||||||
tweet_id: '1471864644562305025'
|
tweet_id: '1471864644562305025'
|
||||||
thread_slug: weekly-thread-2021-01
|
thread_slug: weekly-thread-2021-50
|
||||||
author_username: freekmurze
|
author_username: freekmurze
|
||||||
images:
|
images:
|
||||||
- 'https://pbs.twimg.com/media/FGepj8mWQAUf2R_.jpg'
|
- 'https://pbs.twimg.com/media/FGepj8mWQAUf2R_.jpg'
|
||||||
|
|
@ -14,4 +14,4 @@ Here’s 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
|
https://github.com/spatie/cpu-load-health-check/blob/70f387d5167c24d4000d825a5bddab2504d557fb/src/CpuLoad.php#L17
|
||||||
|
|
||||||
#php
|
#php
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue