From a2adc750ad9cfcd222c1848624d066a087efa4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sat, 9 Apr 2022 02:35:20 +0200 Subject: [PATCH] Week 14 --- content/authors/BurtDS.md | 5 +++++ content/authors/joemasilotti.md | 5 +++++ content/authors/ryangjchandler.md | 2 +- content/authors/victoryoalli.md | 5 +++++ content/threads/weekly-thread-2022-14.md | 11 +++++++++++ ...-input-with-a-form-using-the-form-attribute.md | 13 +++++++++++++ ...u-can-calculate-the-age-of-carbon-instances.md | 13 +++++++++++++ ...ances-to-remove-all-unnecessary-whitespaces.md | 11 +++++++++++ ...ed-on-a-route-to-accept-soft-deleted-models.md | 14 ++++++++++++++ ...indices-for-transformed-versions-of-columns.md | 15 +++++++++++++++ .../you-can-create-storage-disks-on-the-fly.md | 11 +++++++++++ ...rily-disable-timestamps-when-saving-a-model.md | 14 ++++++++++++++ ...method-to-customize-404-handling-on-a-route.md | 13 +++++++++++++ 13 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 content/authors/BurtDS.md create mode 100644 content/authors/joemasilotti.md create mode 100644 content/authors/victoryoalli.md create mode 100644 content/threads/weekly-thread-2022-14.md create mode 100644 content/tips/you-can-associate-an-input-with-a-form-using-the-form-attribute.md create mode 100644 content/tips/you-can-calculate-the-age-of-carbon-instances.md create mode 100644 content/tips/you-can-call-squish-on-stringable-instances-to-remove-all-unnecessary-whitespaces.md create mode 100644 content/tips/you-can-call-withtrashed-on-a-route-to-accept-soft-deleted-models.md create mode 100644 content/tips/you-can-create-db-indices-for-transformed-versions-of-columns.md create mode 100644 content/tips/you-can-create-storage-disks-on-the-fly.md create mode 100644 content/tips/you-can-temporarily-disable-timestamps-when-saving-a-model.md create mode 100644 content/tips/you-can-use-the-missing-method-to-customize-404-handling-on-a-route.md diff --git a/content/authors/BurtDS.md b/content/authors/BurtDS.md new file mode 100644 index 0000000..2852570 --- /dev/null +++ b/content/authors/BurtDS.md @@ -0,0 +1,5 @@ +--- +username: BurtDS +name: 'Bert De Swaef' +avatar: 'https://pbs.twimg.com/profile_images/1042044375688196097/Ktoa7v3p_normal.jpg' +--- diff --git a/content/authors/joemasilotti.md b/content/authors/joemasilotti.md new file mode 100644 index 0000000..0f67a3a --- /dev/null +++ b/content/authors/joemasilotti.md @@ -0,0 +1,5 @@ +--- +username: joemasilotti +name: 'Joe Masilotti 📗' +avatar: 'https://pbs.twimg.com/profile_images/1469703667791982596/5-0pGyNV_normal.jpg' +--- diff --git a/content/authors/ryangjchandler.md b/content/authors/ryangjchandler.md index 59f36ba..ab78723 100644 --- a/content/authors/ryangjchandler.md +++ b/content/authors/ryangjchandler.md @@ -1,5 +1,5 @@ --- username: ryangjchandler -avatar: 'https://pbs.twimg.com/profile_images/1507600871370391557/Em6_vfLo_normal.png' +avatar: 'https://pbs.twimg.com/profile_images/1512466908746235904/6jQdQZim_normal.png' name: 'Ryan Chandler' --- diff --git a/content/authors/victoryoalli.md b/content/authors/victoryoalli.md new file mode 100644 index 0000000..dfe2fa1 --- /dev/null +++ b/content/authors/victoryoalli.md @@ -0,0 +1,5 @@ +--- +username: victoryoalli +name: '🧔🏻Victor Yoalli' +avatar: 'https://pbs.twimg.com/profile_images/1511729912297627657/LmidlmsF_normal.png' +--- diff --git a/content/threads/weekly-thread-2022-14.md b/content/threads/weekly-thread-2022-14.md new file mode 100644 index 0000000..42bd567 --- /dev/null +++ b/content/threads/weekly-thread-2022-14.md @@ -0,0 +1,11 @@ +--- +slug: weekly-thread-2022-14 +title: 'Weekly thread #14 of 2022' +tweet_id: '1512463786405294081' +author_username: archtechx +created_at: 2022-04-08T16:14:01+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/you-can-associate-an-input-with-a-form-using-the-form-attribute.md b/content/tips/you-can-associate-an-input-with-a-form-using-the-form-attribute.md new file mode 100644 index 0000000..1cc62b1 --- /dev/null +++ b/content/tips/you-can-associate-an-input-with-a-form-using-the-form-attribute.md @@ -0,0 +1,13 @@ +--- +title: 'You can associate an input with a form using the form= attribute' +tweet_id: '1512463810069598212' +thread_slug: weekly-thread-2022-14 +author_username: joemasilotti +images: + - 'https://pbs.twimg.com/media/FPh2K65VQAQO5xz.jpg' +created_at: 2022-04-08T16:14:07+00:00 +slug: you-can-associate-an-input-with-a-form-using-the-form-attribute +--- +Wait... what?! 🤯 + +https://www.smashingmagazine.com/2022/03/html-attributes-you-never-use/#the-form-attribute-for-form-fields \ No newline at end of file diff --git a/content/tips/you-can-calculate-the-age-of-carbon-instances.md b/content/tips/you-can-calculate-the-age-of-carbon-instances.md new file mode 100644 index 0000000..6834ba9 --- /dev/null +++ b/content/tips/you-can-calculate-the-age-of-carbon-instances.md @@ -0,0 +1,13 @@ +--- +title: 'You can calculate the `age()` of Carbon instances' +tweet_id: '1512463795364384771' +thread_slug: weekly-thread-2022-14 +author_username: victoryoalli +images: + - 'https://pbs.twimg.com/media/FPh7dVyWUAEW5EQ.jpg' +created_at: 2022-04-08T16:14:03+00:00 +slug: you-can-calculate-the-age-of-carbon-instances +--- +#TIL How to calculate the age using a date in Laravel or using Carbon. + +#LaravelTip #PHPTip #dev \ No newline at end of file diff --git a/content/tips/you-can-call-squish-on-stringable-instances-to-remove-all-unnecessary-whitespaces.md b/content/tips/you-can-call-squish-on-stringable-instances-to-remove-all-unnecessary-whitespaces.md new file mode 100644 index 0000000..487a6a1 --- /dev/null +++ b/content/tips/you-can-call-squish-on-stringable-instances-to-remove-all-unnecessary-whitespaces.md @@ -0,0 +1,11 @@ +--- +title: 'You can call `squish()` on Stringable instances to remove all unnecessary whitespaces' +tweet_id: '1512463789215477763' +thread_slug: weekly-thread-2022-14 +author_username: mattkingshott +images: + - 'https://pbs.twimg.com/media/FPqzjjnWUAAolDJ.jpg' +created_at: 2022-04-08T16:14:02+00:00 +slug: you-can-call-squish-on-stringable-instances-to-remove-all-unnecessary-whitespaces +--- +🔥 #Laravel Tip: Hot off the press, the latest release includes the ‘squish’ global helper method by @DwightConrad. It removes all extraneous white space from a string, including between words. It’s like ‘trim’ on steroids :) \ No newline at end of file diff --git a/content/tips/you-can-call-withtrashed-on-a-route-to-accept-soft-deleted-models.md b/content/tips/you-can-call-withtrashed-on-a-route-to-accept-soft-deleted-models.md new file mode 100644 index 0000000..f23dbd7 --- /dev/null +++ b/content/tips/you-can-call-withtrashed-on-a-route-to-accept-soft-deleted-models.md @@ -0,0 +1,14 @@ +--- +title: 'You can call `withTrashed()` on a route to accept soft deleted models' +tweet_id: '1512463792432566274' +thread_slug: weekly-thread-2022-14 +author_username: cosmeescobedo +images: + - 'https://pbs.twimg.com/media/FPizAZxVsAUl-WZ.jpg' +created_at: 2022-04-08T16:14:02+00:00 +slug: you-can-call-withtrashed-on-a-route-to-accept-soft-deleted-models +--- +🔥 Laravel Tip: Route model binding soft-deleted models + +By default, when using route model binding will not retrieve models that have been soft-deleted. +You can change that behavior by using `withTrashed` in your route. \ No newline at end of file diff --git a/content/tips/you-can-create-db-indices-for-transformed-versions-of-columns.md b/content/tips/you-can-create-db-indices-for-transformed-versions-of-columns.md new file mode 100644 index 0000000..2ee611d --- /dev/null +++ b/content/tips/you-can-create-db-indices-for-transformed-versions-of-columns.md @@ -0,0 +1,15 @@ +--- +title: 'You can create DB indices for transformed versions of columns' +tweet_id: '1512463807167139846' +thread_slug: weekly-thread-2022-14 +author_username: tobias_petry +images: + - 'https://pbs.twimg.com/media/FPk6CjSWYAAXwyn.jpg' +created_at: 2022-04-08T16:14:06+00:00 +slug: you-can-create-db-indices-for-transformed-versions-of-columns +--- +⚡️ Database Tip + +Most developers are puzzled that indexes are not used for e.g. WHERE LOWER(email) = ?. But contrary to common belief, an index can be created for these cases! It's called a function-based index and is supported by MySQL and PostgreSQL. + +https://sqlfordevs.io/tips/function-based-index?utm_source=twitter&utm_medium=social&utm_campaign=database_tip_2022_04_05 \ No newline at end of file diff --git a/content/tips/you-can-create-storage-disks-on-the-fly.md b/content/tips/you-can-create-storage-disks-on-the-fly.md new file mode 100644 index 0000000..323f0f5 --- /dev/null +++ b/content/tips/you-can-create-storage-disks-on-the-fly.md @@ -0,0 +1,11 @@ +--- +title: 'You can create Storage disks on the fly' +tweet_id: '1512463804205973508' +thread_slug: weekly-thread-2022-14 +author_username: ryangjchandler +images: + - 'https://pbs.twimg.com/media/FPwqSygWYAAbSUh.jpg' +created_at: 2022-04-08T16:14:05+00:00 +slug: you-can-create-storage-disks-on-the-fly +--- +🔥 Did you know that you can create Storage disks on the fly in @laravelphp? This is super useful when you want your user to provide their own filesystem credentials, e.g. a user can bring their own S3 bucket to your app. \ No newline at end of file diff --git a/content/tips/you-can-temporarily-disable-timestamps-when-saving-a-model.md b/content/tips/you-can-temporarily-disable-timestamps-when-saving-a-model.md new file mode 100644 index 0000000..e175403 --- /dev/null +++ b/content/tips/you-can-temporarily-disable-timestamps-when-saving-a-model.md @@ -0,0 +1,14 @@ +--- +title: 'You can temporarily disable timestamps when saving a model' +tweet_id: '1512463801278291971' +thread_slug: weekly-thread-2022-14 +author_username: BurtDS +images: + - 'https://pbs.twimg.com/media/FPe3PztWQAIaXzC.jpg' +created_at: 2022-04-08T16:14:05+00:00 +slug: you-can-temporarily-disable-timestamps-when-saving-a-model +--- +📝 #Laravel Tip | In some cases you don't want the updated_at field the change when updating small things. .. Did you know you could disable the timestamps while saving your data? +Here is how... 🔥 + +#laraveltip #php #code #development #details \ No newline at end of file diff --git a/content/tips/you-can-use-the-missing-method-to-customize-404-handling-on-a-route.md b/content/tips/you-can-use-the-missing-method-to-customize-404-handling-on-a-route.md new file mode 100644 index 0000000..734b589 --- /dev/null +++ b/content/tips/you-can-use-the-missing-method-to-customize-404-handling-on-a-route.md @@ -0,0 +1,13 @@ +--- +title: 'You can use the `missing` method to customize 404 handling on a route' +tweet_id: '1512463798287814658' +thread_slug: weekly-thread-2022-14 +author_username: cosmeescobedo +images: + - 'https://pbs.twimg.com/media/FPi0WYWUYAQXuWf.jpg' +created_at: 2022-04-08T16:14:04+00:00 +slug: you-can-use-the-missing-method-to-customize-404-handling-on-a-route +--- +🔥 Laravel tip: Customizing Missing Model Behavior in route model bindings + +By default, Laravel throws a 404 error when it can't bind the model, but you can change that behavior by passing a closure to the missing method. \ No newline at end of file