From 5267f948b5cd4aa9784fcaecb42d5ade71df29d9 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Fri, 26 Nov 2021 16:21:56 +0100 Subject: [PATCH] Weekly thread #47 --- content/authors/RBilloir.md | 5 +++++ content/authors/mattkingshott.md | 2 +- content/threads/weekly-thread-2021-47.md | 11 +++++++++++ ...nctions-when-working-with-localized-strings.md | 11 +++++++++++ ...mpt-helper-for-calls-that-can-silently-fail.md | 11 +++++++++++ ...ify-you-by-email-when-a-scheduled-job-fails.md | 11 +++++++++++ ...e-aggregate-methods-to-count-related-models.md | 13 +++++++++++++ ...-boost-the-perceived-speed-of-livewire-apps.md | 13 +++++++++++++ ...ollections-back-to-a-query-builder-instance.md | 15 +++++++++++++++ ...payload-before-they-get-pushed-to-the-queue.md | 15 +++++++++++++++ 10 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 content/authors/RBilloir.md create mode 100644 content/threads/weekly-thread-2021-47.md create mode 100644 content/tips/consider-using-mb-functions-when-working-with-localized-strings.md create mode 100644 content/tips/create-an-attempt-helper-for-calls-that-can-silently-fail.md create mode 100644 content/tips/laravel-can-automatically-notify-you-by-email-when-a-scheduled-job-fails.md create mode 100644 content/tips/use-aggregate-methods-to-count-related-models.md create mode 100644 content/tips/use-prefetching-to-boost-the-perceived-speed-of-livewire-apps.md create mode 100644 content/tips/you-can-convert-eloquent-collections-back-to-a-query-builder-instance.md create mode 100644 content/tips/you-can-implement-the-shouldbeencrypted-interface-on-your-jobs-to-encrypt-their-payload-before-they-get-pushed-to-the-queue.md diff --git a/content/authors/RBilloir.md b/content/authors/RBilloir.md new file mode 100644 index 0000000..0fd1d99 --- /dev/null +++ b/content/authors/RBilloir.md @@ -0,0 +1,5 @@ +--- +username: RBilloir +name: 'Romain ''Maz'' BILLOIR' +avatar: 'https://pbs.twimg.com/profile_images/1154617719330922498/93xUoei7_normal.jpg' +--- diff --git a/content/authors/mattkingshott.md b/content/authors/mattkingshott.md index e3cc42c..63c9640 100644 --- a/content/authors/mattkingshott.md +++ b/content/authors/mattkingshott.md @@ -1,5 +1,5 @@ --- username: mattkingshott -name: 'Matt Kingshott ๐Ÿ' +name: 'Matt Kingshott ๐Ÿš€' avatar: 'https://pbs.twimg.com/profile_images/1444979706571415564/toC9_E-T_normal.jpg' --- diff --git a/content/threads/weekly-thread-2021-47.md b/content/threads/weekly-thread-2021-47.md new file mode 100644 index 0000000..e170613 --- /dev/null +++ b/content/threads/weekly-thread-2021-47.md @@ -0,0 +1,11 @@ +--- +slug: weekly-thread-2021-47 +title: 'Weekly thread #47 of 2021' +tweet_id: '1464247621518651392' +author_username: archtechx +created_at: 2021-11-26T15:16:37+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/consider-using-mb-functions-when-working-with-localized-strings.md b/content/tips/consider-using-mb-functions-when-working-with-localized-strings.md new file mode 100644 index 0000000..84d674d --- /dev/null +++ b/content/tips/consider-using-mb-functions-when-working-with-localized-strings.md @@ -0,0 +1,11 @@ +--- +title: 'Consider using mb_* functions when working with localized strings' +tweet_id: '1464247627696918528' +thread_slug: weekly-thread-2021-47 +author_username: jbrooksuk +images: + - 'https://pbs.twimg.com/media/FEzpA84X0AALH07.jpg' +created_at: 2021-11-26T15:00:13+00:00 +slug: consider-using-mb-functions-when-working-with-localized-strings +--- +Not sure on the difference between "strtoupper" and "mb_strtoupper"? #PHP \ No newline at end of file diff --git a/content/tips/create-an-attempt-helper-for-calls-that-can-silently-fail.md b/content/tips/create-an-attempt-helper-for-calls-that-can-silently-fail.md new file mode 100644 index 0000000..417a384 --- /dev/null +++ b/content/tips/create-an-attempt-helper-for-calls-that-can-silently-fail.md @@ -0,0 +1,11 @@ +--- +title: 'Create an attempt() helper for calls that can silently fail' +tweet_id: '1464247622558896129' +thread_slug: weekly-thread-2021-47 +author_username: mattkingshott +images: + - 'https://pbs.twimg.com/media/FE9oLAyX0AAhIM8.jpg' +created_at: 2021-11-26T15:00:12+00:00 +slug: create-an-attempt-helper-for-calls-that-can-silently-fail +--- +๐Ÿ’ก#Laravel Tip: Here's a useful little helper for when you need to run some code, but don't really need to handle any exceptions it might generate. \ No newline at end of file diff --git a/content/tips/laravel-can-automatically-notify-you-by-email-when-a-scheduled-job-fails.md b/content/tips/laravel-can-automatically-notify-you-by-email-when-a-scheduled-job-fails.md new file mode 100644 index 0000000..16e2338 --- /dev/null +++ b/content/tips/laravel-can-automatically-notify-you-by-email-when-a-scheduled-job-fails.md @@ -0,0 +1,11 @@ +--- +title: 'Laravel can automatically notify you by email when a scheduled job fails' +tweet_id: '1464247630377021448' +thread_slug: weekly-thread-2021-47 +author_username: mattkingshott +images: + - 'https://pbs.twimg.com/media/FE3z7XuXsAA-RJk.jpg' +created_at: 2021-11-26T15:00:14+00:00 +slug: laravel-can-automatically-notify-you-by-email-when-a-scheduled-job-fails +--- +๐Ÿ’ก#Laravel Tip: Did you know that any commands you schedule in the console kernel can automatically email their output if something goes wrong. \ No newline at end of file diff --git a/content/tips/use-aggregate-methods-to-count-related-models.md b/content/tips/use-aggregate-methods-to-count-related-models.md new file mode 100644 index 0000000..3dc2dfa --- /dev/null +++ b/content/tips/use-aggregate-methods-to-count-related-models.md @@ -0,0 +1,13 @@ +--- +title: 'Use aggregate methods to count related models' +tweet_id: '1464247626405060616' +thread_slug: weekly-thread-2021-47 +author_username: alexjgarrett +images: + - 'https://pbs.twimg.com/media/FEy-iNNX0AYjL56.jpg' +created_at: 2021-11-26T15:00:13+00:00 +slug: use-aggregate-methods-to-count-related-models +--- +When you're counting related models in @laravelphp, opt for aggregates! + +๐Ÿ‘Ž Using the count() method on a collection of related models is a tad slower. \ No newline at end of file diff --git a/content/tips/use-prefetching-to-boost-the-perceived-speed-of-livewire-apps.md b/content/tips/use-prefetching-to-boost-the-perceived-speed-of-livewire-apps.md new file mode 100644 index 0000000..84ca042 --- /dev/null +++ b/content/tips/use-prefetching-to-boost-the-perceived-speed-of-livewire-apps.md @@ -0,0 +1,13 @@ +--- +title: 'Use prefetching to boost the perceived speed of Livewire apps' +tweet_id: '1464247623796232193' +thread_slug: weekly-thread-2021-47 +author_username: alexjgarrett +images: + - 'https://pbs.twimg.com/media/FE9K7s_X0AMvYbA.jpg' +created_at: 2021-11-26T15:00:12+00:00 +slug: use-prefetching-to-boost-the-perceived-speed-of-livewire-apps +--- +To boost perceived speed in your @LaravelLivewire apps when loading data, make use of prefetching. + +The .prefetch modifier tells Livewire to fetch the result in the background on *hover*, and then displays the result when the button is actually clicked โœจ \ No newline at end of file diff --git a/content/tips/you-can-convert-eloquent-collections-back-to-a-query-builder-instance.md b/content/tips/you-can-convert-eloquent-collections-back-to-a-query-builder-instance.md new file mode 100644 index 0000000..9c98738 --- /dev/null +++ b/content/tips/you-can-convert-eloquent-collections-back-to-a-query-builder-instance.md @@ -0,0 +1,15 @@ +--- +title: 'You can convert Eloquent Collections back to a Query Builder instance' +tweet_id: '1464247625046114305' +thread_slug: weekly-thread-2021-47 +author_username: RBilloir +images: + - 'https://pbs.twimg.com/media/FEvymV7XsAE3Vv2.png' +created_at: 2021-11-26T15:00:12+00:00 +slug: you-can-convert-eloquent-collections-back-to-a-query-builder-instance +--- +A tiny tip about #laravel eloquent. + +To retrieve the Query Builder after filtering the results: you can use `->toQuery()`. + +The method internally use the first model of the collection and a `whereKey` comparison on the Collection models. \ No newline at end of file diff --git a/content/tips/you-can-implement-the-shouldbeencrypted-interface-on-your-jobs-to-encrypt-their-payload-before-they-get-pushed-to-the-queue.md b/content/tips/you-can-implement-the-shouldbeencrypted-interface-on-your-jobs-to-encrypt-their-payload-before-they-get-pushed-to-the-queue.md new file mode 100644 index 0000000..80edf04 --- /dev/null +++ b/content/tips/you-can-implement-the-shouldbeencrypted-interface-on-your-jobs-to-encrypt-their-payload-before-they-get-pushed-to-the-queue.md @@ -0,0 +1,15 @@ +--- +title: 'You can implement the ShouldBeEncrypted interface on your jobs to encrypt their payload before they get pushed to the queue' +tweet_id: '1464247629030703108' +thread_slug: weekly-thread-2021-47 +author_username: pascalbaljet +images: + - 'https://pbs.twimg.com/media/FEyahMTXoAAv8gH.jpg' +created_at: 2021-11-26T15:00:13+00:00 +slug: you-can-implement-the-shouldbeencrypted-interface-on-your-jobs-to-encrypt-their-payload-before-they-get-pushed-to-the-queue +--- +๐Ÿ’ก Since @laravelphp v8.19, there is a ShouldBeEncrypted interface that jobs can implement. This encrypts the payload, for example, in case the properties hold sensitive data. + +As of v8.25, this works for Listeners, Mailables, and Notifications as well ๐Ÿ’ซ + +#Laravel #PHP #webdev https://twitter.com/pascalbaljet/status/1462711618329055232 \ No newline at end of file