From 6d630dcea89d60c5514d586df6161d845097b493 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Mon, 28 Feb 2022 08:45:52 +0100 Subject: [PATCH] Weekly thread #8 --- content/authors/bobbybouwmann.md | 5 +++++ content/authors/carre_sam.md | 5 +++++ content/authors/enunomaduro.md | 2 +- content/threads/weekly-thread-2022-08.md | 11 +++++++++++ .../create-methods-for-complex-conditionals.md | 11 +++++++++++ ...sing-separate-methods-inside-a-single-class.md | 15 +++++++++++++++ ...stamp-fields-using-the-action-at-convention.md | 15 +++++++++++++++ ...-names-in-quotes-when-running-makemigration.md | 11 +++++++++++ ...ions-to-send-messages-to-unregistered-users.md | 15 +++++++++++++++ ...g-with-the-object-and-immediately-return-it.md | 11 +++++++++++ ...re-are-multiple-results-with-the-same-value.md | 13 +++++++++++++ 11 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 content/authors/bobbybouwmann.md create mode 100644 content/authors/carre_sam.md create mode 100644 content/threads/weekly-thread-2022-08.md create mode 100644 content/tips/create-methods-for-complex-conditionals.md create mode 100644 content/tips/create-subscribers-to-listen-to-amp-handle-multiple-events-using-separate-methods-inside-a-single-class.md create mode 100644 content/tips/name-all-timestamp-fields-using-the-action-at-convention.md create mode 100644 content/tips/put-migration-names-in-quotes-when-running-makemigration.md create mode 100644 content/tips/use-on-demand-notifications-to-send-messages-to-unregistered-users.md create mode 100644 content/tips/use-tap-to-do-something-with-the-object-and-immediately-return-it.md create mode 100644 content/tips/use-the-with-ties-clause-to-return-more-than-the-limit-ed-amount-when-there-are-multiple-results-with-the-same-value.md diff --git a/content/authors/bobbybouwmann.md b/content/authors/bobbybouwmann.md new file mode 100644 index 0000000..8ce55d0 --- /dev/null +++ b/content/authors/bobbybouwmann.md @@ -0,0 +1,5 @@ +--- +username: bobbybouwmann +name: 'Bobby Bouwmann' +avatar: 'https://pbs.twimg.com/profile_images/1480249385288146948/Xn-QKln5_normal.jpg' +--- diff --git a/content/authors/carre_sam.md b/content/authors/carre_sam.md new file mode 100644 index 0000000..4bfbcc1 --- /dev/null +++ b/content/authors/carre_sam.md @@ -0,0 +1,5 @@ +--- +username: carre_sam +name: 'Sam CarrΓ© 🀠' +avatar: 'https://pbs.twimg.com/profile_images/1483207390271004678/1l9fV1y-_normal.jpg' +--- diff --git a/content/authors/enunomaduro.md b/content/authors/enunomaduro.md index eff057d..9ff9882 100644 --- a/content/authors/enunomaduro.md +++ b/content/authors/enunomaduro.md @@ -1,5 +1,5 @@ --- username: enunomaduro -name: 'Nuno Maduro' avatar: 'https://pbs.twimg.com/profile_images/1433501939648565257/hT4oXpfq_normal.jpg' +name: 'Nuno Maduro 🀌🏻' --- diff --git a/content/threads/weekly-thread-2022-08.md b/content/threads/weekly-thread-2022-08.md new file mode 100644 index 0000000..be77664 --- /dev/null +++ b/content/threads/weekly-thread-2022-08.md @@ -0,0 +1,11 @@ +--- +slug: weekly-thread-2022-08 +title: 'Weekly thread #08 of 2022' +tweet_id: '1498010788463710209' +author_username: archtechx +created_at: 2022-02-27T19:02:58+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/create-methods-for-complex-conditionals.md b/content/tips/create-methods-for-complex-conditionals.md new file mode 100644 index 0000000..32af3cf --- /dev/null +++ b/content/tips/create-methods-for-complex-conditionals.md @@ -0,0 +1,11 @@ +--- +title: 'Create methods for complex conditionals' +tweet_id: '1498010809179332609' +thread_slug: weekly-thread-2022-08 +author_username: enunomaduro +images: + - 'https://pbs.twimg.com/media/FMI11QtXMAUnCID.jpg' +created_at: 2022-02-27T19:03:03+00:00 +slug: create-methods-for-complex-conditionals +--- +Encapsulating complex conditionals offering a "callable" API is sexy AF. πŸ‘ \ No newline at end of file diff --git a/content/tips/create-subscribers-to-listen-to-amp-handle-multiple-events-using-separate-methods-inside-a-single-class.md b/content/tips/create-subscribers-to-listen-to-amp-handle-multiple-events-using-separate-methods-inside-a-single-class.md new file mode 100644 index 0000000..189f64b --- /dev/null +++ b/content/tips/create-subscribers-to-listen-to-amp-handle-multiple-events-using-separate-methods-inside-a-single-class.md @@ -0,0 +1,15 @@ +--- +title: 'Create Subscribers to listen to & handle multiple events using separate methods, inside a single class' +tweet_id: '1498010791303282688' +thread_slug: weekly-thread-2022-08 +author_username: bobbybouwmann +images: + - 'https://pbs.twimg.com/media/FMJNvELWYAs0iij.jpg' +created_at: 2022-02-27T19:02:58+00:00 +slug: create-subscribers-to-listen-to-amp-handle-multiple-events-using-separate-methods-inside-a-single-class +--- +Did you know that you can create a "Subscriber" class in Laravel to handle multiple events with different methods in one Listener class? + +This is very useful if you want to group certain actions with the same dependencies. + +Documentation: https://laravel.com/docs/9.x/events#event-subscribers \ No newline at end of file diff --git a/content/tips/name-all-timestamp-fields-using-the-action-at-convention.md b/content/tips/name-all-timestamp-fields-using-the-action-at-convention.md new file mode 100644 index 0000000..16bf8ba --- /dev/null +++ b/content/tips/name-all-timestamp-fields-using-the-action-at-convention.md @@ -0,0 +1,15 @@ +--- +title: 'Name *all* timestamp fields using the action_at convention' +tweet_id: '1498010797083009025' +thread_slug: weekly-thread-2022-08 +author_username: AshAllenDesign +images: + - 'https://pbs.twimg.com/media/FLy78SOXsAMRB2g.jpg' +created_at: 2022-02-27T19:03:00+00:00 +slug: name-all-timestamp-fields-using-the-action-at-convention +--- +Laravel tip: Use the "{action}_at" naming convention for your DATETIME and TIMESTAMP fields. + +This helps you to instantly recognise in your code when you're using a datetime field πŸ˜„ + +#laravel #php \ No newline at end of file diff --git a/content/tips/put-migration-names-in-quotes-when-running-makemigration.md b/content/tips/put-migration-names-in-quotes-when-running-makemigration.md new file mode 100644 index 0000000..43172f1 --- /dev/null +++ b/content/tips/put-migration-names-in-quotes-when-running-makemigration.md @@ -0,0 +1,11 @@ +--- +title: 'Put migration names in quotes when running make:migration' +tweet_id: '1498010806155235328' +thread_slug: weekly-thread-2022-08 +author_username: carre_sam +images: + - 'https://pbs.twimg.com/media/FMDWVEAXEAcHEKE.jpg' +created_at: 2022-02-27T19:03:02+00:00 +slug: put-migration-names-in-quotes-when-running-makemigration +--- +πŸ‘€ Laravel Tip: Save time when typing migration names by using quotes around the name! \ No newline at end of file diff --git a/content/tips/use-on-demand-notifications-to-send-messages-to-unregistered-users.md b/content/tips/use-on-demand-notifications-to-send-messages-to-unregistered-users.md new file mode 100644 index 0000000..bae4a7f --- /dev/null +++ b/content/tips/use-on-demand-notifications-to-send-messages-to-unregistered-users.md @@ -0,0 +1,15 @@ +--- +title: 'Use on-demand notifications to send messages to unregistered users' +tweet_id: '1498010803156381696' +thread_slug: weekly-thread-2022-08 +author_username: bhaidar +images: + - 'https://pbs.twimg.com/media/FKDorcxVQAEERjT.jpg' +created_at: 2022-02-27T19:03:01+00:00 +slug: use-on-demand-notifications-to-send-messages-to-unregistered-users +--- +🌢️ #Laravel tip: Sometimes you may need to send a notification to someone who is not stored as a "user" of your application. + +Welcome to On-Demand Notifications in Laravel πŸ”₯ + +#PHP #Developers \ No newline at end of file diff --git a/content/tips/use-tap-to-do-something-with-the-object-and-immediately-return-it.md b/content/tips/use-tap-to-do-something-with-the-object-and-immediately-return-it.md new file mode 100644 index 0000000..64bbaff --- /dev/null +++ b/content/tips/use-tap-to-do-something-with-the-object-and-immediately-return-it.md @@ -0,0 +1,11 @@ +--- +title: 'Use tap() to do something with the object and immediately return it' +tweet_id: '1498010800098734081' +thread_slug: weekly-thread-2022-08 +author_username: enunomaduro +images: + - 'https://pbs.twimg.com/media/FMMN_6wXsAMmS_e.jpg' +created_at: 2022-02-27T19:03:01+00:00 +slug: use-tap-to-do-something-with-the-object-and-immediately-return-it +--- +Use the @laravelphp's "tap()" function to do something with an object, and then return the object itself. πŸ§‹ \ No newline at end of file diff --git a/content/tips/use-the-with-ties-clause-to-return-more-than-the-limit-ed-amount-when-there-are-multiple-results-with-the-same-value.md b/content/tips/use-the-with-ties-clause-to-return-more-than-the-limit-ed-amount-when-there-are-multiple-results-with-the-same-value.md new file mode 100644 index 0000000..c445ca5 --- /dev/null +++ b/content/tips/use-the-with-ties-clause-to-return-more-than-the-limit-ed-amount-when-there-are-multiple-results-with-the-same-value.md @@ -0,0 +1,13 @@ +--- +title: 'Use the `WITH TIES` clause to return more than the `LIMIT`-ed amount when there are multiple results with the same value' +tweet_id: '1498010794155380736' +thread_slug: weekly-thread-2022-08 +author_username: tobias_petry +images: + - 'https://pbs.twimg.com/media/FMSIa6kXsAQ2Axf.jpg' +created_at: 2022-02-27T19:02:59+00:00 +slug: use-the-with-ties-clause-to-return-more-than-the-limit-ed-amount-when-there-are-multiple-results-with-the-same-value +--- +⚑️ Database Tip + +Everyone knows the LIMIT clause. But what do you do if you want to have e.g. the employees with the TOP 3 salaries *and* not exclude the 4th or 5th one earning the same as the 3rd? The WITH TIES clause can return more results if the value is the same. Great! \ No newline at end of file