From 3ed17d8cef6d636c2f82c9417f4b0e02276099bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sun, 17 Apr 2022 20:03:34 +0200 Subject: [PATCH] Week 15 of 2022 --- content/threads/weekly-thread-2022-15.md | 11 +++++++++++ ...al-and-prompting-the-user-when-theyre-empty.md | 15 +++++++++++++++ ...u-can-use-onsuccess-and-onfailure-callbacks.md | 11 +++++++++++ ...method-lets-you-cache-model-accessor-values.md | 13 +++++++++++++ ...-and-correctly-assigns-array-values-to-them.md | 11 +++++++++++ .../you-can-generate-fake-images-using-faker.md | 11 +++++++++++ ...uled-tasks-send-an-email-or-write-to-a-file.md | 11 +++++++++++ 7 files changed, 83 insertions(+) create mode 100644 content/threads/weekly-thread-2022-15.md create mode 100644 content/tips/improve-the-dx-of-your-commands-by-making-arguments-optional-and-prompting-the-user-when-theyre-empty.md create mode 100644 content/tips/in-scheduled-tasks-you-can-use-onsuccess-and-onfailure-callbacks.md create mode 100644 content/tips/the-shouldcache-method-lets-you-cache-model-accessor-values.md create mode 100644 content/tips/the-spread-syntax-understands-named-parameters-and-correctly-assigns-array-values-to-them.md create mode 100644 content/tips/you-can-generate-fake-images-using-faker.md create mode 100644 content/tips/you-can-process-the-output-of-scheduled-tasks-send-an-email-or-write-to-a-file.md diff --git a/content/threads/weekly-thread-2022-15.md b/content/threads/weekly-thread-2022-15.md new file mode 100644 index 0000000..8b731ca --- /dev/null +++ b/content/threads/weekly-thread-2022-15.md @@ -0,0 +1,11 @@ +--- +slug: weekly-thread-2022-15 +title: 'Weekly thread #15 of 2022' +tweet_id: '1515057381511610368' +author_username: archtechx +created_at: 2022-04-15T20:00:02+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/improve-the-dx-of-your-commands-by-making-arguments-optional-and-prompting-the-user-when-theyre-empty.md b/content/tips/improve-the-dx-of-your-commands-by-making-arguments-optional-and-prompting-the-user-when-theyre-empty.md new file mode 100644 index 0000000..1983546 --- /dev/null +++ b/content/tips/improve-the-dx-of-your-commands-by-making-arguments-optional-and-prompting-the-user-when-theyre-empty.md @@ -0,0 +1,15 @@ +--- +title: 'Improve the DX of your commands by making arguments optional and prompting the user when they''re empty' +tweet_id: '1515057387027140609' +thread_slug: weekly-thread-2022-15 +author_username: mmartin_joo +images: + - 'https://pbs.twimg.com/media/FQAcwOkWUAESOwS.jpg' +created_at: 2022-04-15T20:00:04+00:00 +slug: improve-the-dx-of-your-commands-by-making-arguments-optional-and-prompting-the-user-when-theyre-empty +--- +💡 Just a quick tip: define every argument of commands as optional and ask for input if they are missing. + +This way, you don’t need to think about the arguments when running a command. + +Just run it, and it will ask everything: \ No newline at end of file diff --git a/content/tips/in-scheduled-tasks-you-can-use-onsuccess-and-onfailure-callbacks.md b/content/tips/in-scheduled-tasks-you-can-use-onsuccess-and-onfailure-callbacks.md new file mode 100644 index 0000000..9ee310f --- /dev/null +++ b/content/tips/in-scheduled-tasks-you-can-use-onsuccess-and-onfailure-callbacks.md @@ -0,0 +1,11 @@ +--- +title: 'In scheduled tasks, you can use `onSuccess` and `onFailure` callbacks' +tweet_id: '1515057395763798018' +thread_slug: weekly-thread-2022-15 +author_username: cosmeescobedo +images: + - 'https://pbs.twimg.com/media/FQAK8H-XEAMWMMT.jpg' +created_at: 2022-04-15T20:00:06+00:00 +slug: in-scheduled-tasks-you-can-use-onsuccess-and-onfailure-callbacks +--- +🔥 Laravel Tip: You can specify what to do if a scheduled task fails or succeeds. \ No newline at end of file diff --git a/content/tips/the-shouldcache-method-lets-you-cache-model-accessor-values.md b/content/tips/the-shouldcache-method-lets-you-cache-model-accessor-values.md new file mode 100644 index 0000000..129c4ac --- /dev/null +++ b/content/tips/the-shouldcache-method-lets-you-cache-model-accessor-values.md @@ -0,0 +1,13 @@ +--- +title: 'The `shouldCache()` method lets you cache model accessor values' +tweet_id: '1515057389950537729' +thread_slug: weekly-thread-2022-15 +author_username: cosmeescobedo +images: + - 'https://pbs.twimg.com/media/FQOpEt5VQA0OnWt.jpg' +created_at: 2022-04-15T20:00:04+00:00 +slug: the-shouldcache-method-lets-you-cache-model-accessor-values +--- +🔥 Laravel Tip: Accessor Caching + +As of Laravel 9.6, if you have a computationally intensive accessor, you can use the shouldCache method. \ No newline at end of file diff --git a/content/tips/the-spread-syntax-understands-named-parameters-and-correctly-assigns-array-values-to-them.md b/content/tips/the-spread-syntax-understands-named-parameters-and-correctly-assigns-array-values-to-them.md new file mode 100644 index 0000000..76179b7 --- /dev/null +++ b/content/tips/the-spread-syntax-understands-named-parameters-and-correctly-assigns-array-values-to-them.md @@ -0,0 +1,11 @@ +--- +title: 'The spread syntax understands named parameters and correctly assigns array values to them' +tweet_id: '1515057384204382208' +thread_slug: weekly-thread-2022-15 +author_username: SteveTheBauman +images: + - 'https://pbs.twimg.com/media/FQJ4FUcX0A01ZUZ.jpg' +created_at: 2022-04-15T20:00:03+00:00 +slug: the-spread-syntax-understands-named-parameters-and-correctly-assigns-array-values-to-them +--- +Today I learned that PHP will insert callback parameters in the order of their defined name, when spreading an array of args with string keys, allowing you to place them in any position in the callback. Super cool! 💪 \ No newline at end of file diff --git a/content/tips/you-can-generate-fake-images-using-faker.md b/content/tips/you-can-generate-fake-images-using-faker.md new file mode 100644 index 0000000..af671f8 --- /dev/null +++ b/content/tips/you-can-generate-fake-images-using-faker.md @@ -0,0 +1,11 @@ +--- +title: 'You can generate fake images using Faker' +tweet_id: '1515057392890769410' +thread_slug: weekly-thread-2022-15 +author_username: justsanjit +images: + - 'https://pbs.twimg.com/media/FQOhGy6XEAMYB-X.jpg' +created_at: 2022-04-15T20:00:05+00:00 +slug: you-can-generate-fake-images-using-faker +--- +#Laravel #PHP Tip 🔥 You can use #faker to not only generate text values but also fake images. \ No newline at end of file diff --git a/content/tips/you-can-process-the-output-of-scheduled-tasks-send-an-email-or-write-to-a-file.md b/content/tips/you-can-process-the-output-of-scheduled-tasks-send-an-email-or-write-to-a-file.md new file mode 100644 index 0000000..b482770 --- /dev/null +++ b/content/tips/you-can-process-the-output-of-scheduled-tasks-send-an-email-or-write-to-a-file.md @@ -0,0 +1,11 @@ +--- +title: 'You can process the output of scheduled tasks: send an email or write to a file' +tweet_id: '1515057398687313920' +thread_slug: weekly-thread-2022-15 +author_username: justsanjit +images: + - 'https://pbs.twimg.com/media/FQHMYW4WQAIxF69.jpg' +created_at: 2022-04-15T20:00:06+00:00 +slug: you-can-process-the-output-of-scheduled-tasks-send-an-email-or-write-to-a-file +--- +#Laravel Tip 🔥 Few convenient methods to work with the output of scheduled tasks. \ No newline at end of file