diff --git a/content/authors/LupinityLabs.md b/content/authors/LupinityLabs.md new file mode 100644 index 0000000..a412ce8 --- /dev/null +++ b/content/authors/LupinityLabs.md @@ -0,0 +1,5 @@ +--- +username: LupinityLabs +name: 'Lupinity Labs | Freelance Software Dev' +avatar: 'https://pbs.twimg.com/profile_images/918075255540928514/a0jLVHar_normal.jpg' +--- diff --git a/content/authors/ecrmnn.md b/content/authors/ecrmnn.md index b31b42f..213b820 100644 --- a/content/authors/ecrmnn.md +++ b/content/authors/ecrmnn.md @@ -1,5 +1,5 @@ --- username: ecrmnn +avatar: 'https://pbs.twimg.com/profile_images/1524726574095998976/eIfzkehc_normal.jpg' name: 'Daniel Eckermann' -avatar: 'https://pbs.twimg.com/profile_images/1433834747411767306/rEA7K8oI_normal.jpg' --- diff --git a/content/threads/weekly-thread-2022-24.md b/content/threads/weekly-thread-2022-24.md new file mode 100644 index 0000000..45ee0b5 --- /dev/null +++ b/content/threads/weekly-thread-2022-24.md @@ -0,0 +1,11 @@ +--- +slug: weekly-thread-2022-24 +title: 'Weekly thread #24 of 2022' +tweet_id: '1538579116080762880' +author_username: archtechx +created_at: 2022-06-19T17:47: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/databases-can-generate-random-uuid-keys.md b/content/tips/databases-can-generate-random-uuid-keys.md new file mode 100644 index 0000000..a3a9b99 --- /dev/null +++ b/content/tips/databases-can-generate-random-uuid-keys.md @@ -0,0 +1,15 @@ +--- +title: 'Databases can generate random UUID keys' +tweet_id: '1538579134703497216' +thread_slug: weekly-thread-2022-24 +author_username: tobias_petry +images: + - 'https://pbs.twimg.com/media/FUuDWADWAAAapY7.jpg' +created_at: 2022-06-19T17:47:05+00:00 +slug: databases-can-generate-random-uuid-keys +--- +⚑️ Database Tip + +Many applications use the table's numeric primary key in the URL: Bots can scrape all data by incrementing the ID and competitors know your number of customers/resources and growth.Adding a random UUID which is used in URLs solves this. + +https://sqlfordevs.io/uuid-prevent-enumeration-attack \ No newline at end of file diff --git a/content/tips/long-classes-can-be-split-into-small-single-use-traits.md b/content/tips/long-classes-can-be-split-into-small-single-use-traits.md new file mode 100644 index 0000000..3be385a --- /dev/null +++ b/content/tips/long-classes-can-be-split-into-small-single-use-traits.md @@ -0,0 +1,13 @@ +--- +title: 'Long classes can be split into small single-use traits' +tweet_id: '1538579137463406592' +thread_slug: weekly-thread-2022-24 +author_username: archtechx +images: + - 'https://pbs.twimg.com/media/FVSanUMUcAA5iRg.jpg' +created_at: 2022-06-19T17:47:06+00:00 +slug: long-classes-can-be-split-into-small-single-use-traits +--- +πŸ’‘ Create single-use traits to split up long classes into smaller parts + +This way, all e.g. link-related logic can be contained within a single trait \ No newline at end of file diff --git a/content/tips/method-parameters-can-be-marked-as-sensitive.md b/content/tips/method-parameters-can-be-marked-as-sensitive.md new file mode 100644 index 0000000..d4c0447 --- /dev/null +++ b/content/tips/method-parameters-can-be-marked-as-sensitive.md @@ -0,0 +1,13 @@ +--- +title: 'Method parameters can be marked as "sensitive”' +tweet_id: '1538579129276059648' +thread_slug: weekly-thread-2022-24 +author_username: SteveTheBauman +images: + - 'https://pbs.twimg.com/media/FVZSWpkXwAITTAp.jpg' +created_at: 2022-06-19T17:47:04+00:00 +slug: method-parameters-can-be-marked-as-sensitive +--- +Apparently in PHP 8.2, you can mark method parameters as "sensitive" so that they are not printed in debug_backtrace 🀯 + +https://php.watch/versions/8.2/backtrace-parameter-redaction \ No newline at end of file diff --git a/content/tips/uploaded-files-can-be-attached-to-emails-directly-from-the-request.md b/content/tips/uploaded-files-can-be-attached-to-emails-directly-from-the-request.md new file mode 100644 index 0000000..7aeaa16 --- /dev/null +++ b/content/tips/uploaded-files-can-be-attached-to-emails-directly-from-the-request.md @@ -0,0 +1,15 @@ +--- +title: 'Uploaded files can be attached to emails directly from the request' +tweet_id: '1538579118551248896' +thread_slug: weekly-thread-2022-24 +author_username: ecrmnn +images: + - 'https://pbs.twimg.com/media/FVOf_L_UcAUYEaK.jpg' +created_at: 2022-06-19T17:47:01+00:00 +slug: uploaded-files-can-be-attached-to-emails-directly-from-the-request +--- +Sending emails with user uploaded files in Laravel? + +Did you know you don't have to save the file first β€” you can simply attach the uploaded file with `attachData` πŸ’Œ πŸ“Έ + +Here's a snippet from a Mailable class using it. \ No newline at end of file diff --git a/content/tips/you-can-add-a-uri-fragment-when-redirecting-to-a-route.md b/content/tips/you-can-add-a-uri-fragment-when-redirecting-to-a-route.md new file mode 100644 index 0000000..9c117b5 --- /dev/null +++ b/content/tips/you-can-add-a-uri-fragment-when-redirecting-to-a-route.md @@ -0,0 +1,13 @@ +--- +title: 'You can add a URI fragment when redirecting to a route' +tweet_id: '1538579123949346816' +thread_slug: weekly-thread-2022-24 +author_username: ecrmnn +images: + - 'https://pbs.twimg.com/media/FVYsVf5VsAEan8N.jpg' +created_at: 2022-06-19T17:47:03+00:00 +slug: you-can-add-a-uri-fragment-when-redirecting-to-a-route +--- +You can add a URI fragment when redirecting to a route in Laravel. + +This is super useful when redirecting to a specific section of the page. E.g. reviews section on a product page πŸ“ˆ \ No newline at end of file diff --git a/content/tips/you-can-customize-default-validation-rules-for-passwords.md b/content/tips/you-can-customize-default-validation-rules-for-passwords.md new file mode 100644 index 0000000..ac3465f --- /dev/null +++ b/content/tips/you-can-customize-default-validation-rules-for-passwords.md @@ -0,0 +1,15 @@ +--- +title: 'You can customize default validation rules for passwords' +tweet_id: '1538579140147699712' +thread_slug: weekly-thread-2022-24 +author_username: ecrmnn +images: + - 'https://pbs.twimg.com/media/FUqvZeiVEAAsdBC.jpg' +created_at: 2022-06-19T17:47:07+00:00 +slug: you-can-customize-default-validation-rules-for-passwords +--- +You can specify the default validation rules for passwords in a single location of your Laravel app πŸ” + +Create a custom provider or use the AppServiceProvider. Then use `Password::defaults()` as validation rule βœ… + +You can have different defaults depending on the app environment. \ No newline at end of file diff --git a/content/tips/you-can-import-entire-namespaces-in-php.md b/content/tips/you-can-import-entire-namespaces-in-php.md new file mode 100644 index 0000000..b42b7a7 --- /dev/null +++ b/content/tips/you-can-import-entire-namespaces-in-php.md @@ -0,0 +1,13 @@ +--- +title: 'You can import entire namespaces in PHP' +tweet_id: '1538579126595899393' +thread_slug: weekly-thread-2022-24 +author_username: archtechx +images: + - 'https://pbs.twimg.com/media/FVYDILtUAAAmQlc.jpg' +created_at: 2022-06-19T17:47:03+00:00 +slug: you-can-import-entire-namespaces-in-php +--- +πŸ”₯ You can import entire namespaces in PHP + +This is useful when you're interacting with *many* classes from a single namespace \ No newline at end of file diff --git a/content/tips/you-can-namespace-your-helper-functions.md b/content/tips/you-can-namespace-your-helper-functions.md new file mode 100644 index 0000000..6f03569 --- /dev/null +++ b/content/tips/you-can-namespace-your-helper-functions.md @@ -0,0 +1,11 @@ +--- +title: 'You can namespace your helper functions' +tweet_id: '1538579132019187712' +thread_slug: weekly-thread-2022-24 +author_username: archtechx +images: + - 'https://pbs.twimg.com/media/FUzJCu8UcAAdBfT.jpg' +created_at: 2022-06-19T17:47:05+00:00 +slug: you-can-namespace-your-helper-functions +--- +πŸ”₯ Namespaced functions are a good way to make use of helper functions, while avoiding conflicts in the global namespace \ No newline at end of file diff --git a/content/tips/you-can-use-eloquent-wherecolumn-to-compare-columns-to-each-other.md b/content/tips/you-can-use-eloquent-wherecolumn-to-compare-columns-to-each-other.md new file mode 100644 index 0000000..b3cb5a6 --- /dev/null +++ b/content/tips/you-can-use-eloquent-wherecolumn-to-compare-columns-to-each-other.md @@ -0,0 +1,13 @@ +--- +title: 'You can use Eloquent `whereColumn()` to compare columns to each other' +tweet_id: '1538579121193701377' +thread_slug: weekly-thread-2022-24 +author_username: LupinityLabs +images: + - 'https://pbs.twimg.com/media/FUw13BSXEAI1_xQ.jpg' +created_at: 2022-06-19T17:47:02+00:00 +slug: you-can-use-eloquent-wherecolumn-to-compare-columns-to-each-other +--- +πŸ’‘πŸŸ° Quick #Laravel Eloquent tip for comparing database columns to each other within a query. + +You don't have to use any raw statements to do this - whereColumn() has got you covered! 😊 \ No newline at end of file