diff --git a/content/threads/weekly-thread-2022-07.md b/content/threads/weekly-thread-2022-07.md new file mode 100644 index 0000000..19de0b4 --- /dev/null +++ b/content/threads/weekly-thread-2022-07.md @@ -0,0 +1,11 @@ +--- +slug: weekly-thread-2022-07 +title: 'Weekly thread #07 of 2022' +tweet_id: '1495414929053995012' +author_username: archtechx +created_at: 2022-02-20T15:07:57+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/move-tests-to-separate-test-suites.md b/content/tips/move-tests-to-separate-test-suites.md new file mode 100644 index 0000000..b553d12 --- /dev/null +++ b/content/tips/move-tests-to-separate-test-suites.md @@ -0,0 +1,11 @@ +--- +title: 'Move tests to separate test suites' +tweet_id: '1495414937757253636' +thread_slug: weekly-thread-2022-07 +author_username: JackEllis +images: + - 'https://pbs.twimg.com/media/FLVuSJRVQAEQffe.jpg' +created_at: 2022-02-20T15:07:59+00:00 +slug: move-tests-to-separate-test-suites +--- +My Laravel tip of the day. If you're running slow tests that need to hit a third party API, you can break them out of your Features directory and put them in a dedicated test suite (e.g. External). Then you can run "phpunit --testsuite Feature", and your External tests won't run. \ No newline at end of file diff --git a/content/tips/use-comments-for-explaining-complex-logic.md b/content/tips/use-comments-for-explaining-complex-logic.md new file mode 100644 index 0000000..daf8662 --- /dev/null +++ b/content/tips/use-comments-for-explaining-complex-logic.md @@ -0,0 +1,11 @@ +--- +title: 'Use comments for explaining complex logic' +tweet_id: '1495414946556903424' +thread_slug: weekly-thread-2022-07 +author_username: brendt_gd +images: + - 'https://pbs.twimg.com/media/FLsw0t6XwAIe5aI.jpg' +created_at: 2022-02-20T15:08:01+00:00 +slug: use-comments-for-explaining-complex-logic +--- +Comments in code should be used with care. They should only be added when they add actual value to the programmer; which is why I style them in such a way that they "pop out", instead of them disappearing in the background. \ No newline at end of file diff --git a/content/tips/use-fakernumerify-to-create-strings-with-numbers-at-specific-places.md b/content/tips/use-fakernumerify-to-create-strings-with-numbers-at-specific-places.md new file mode 100644 index 0000000..f650916 --- /dev/null +++ b/content/tips/use-fakernumerify-to-create-strings-with-numbers-at-specific-places.md @@ -0,0 +1,11 @@ +--- +title: 'Use Faker::numerify() to create strings with numbers at specific places' +tweet_id: '1495414931788746755' +thread_slug: weekly-thread-2022-07 +author_username: SteveTheBauman +images: + - 'https://pbs.twimg.com/media/FLkESRpXIAwj769.jpg' +created_at: 2022-02-20T15:07:57+00:00 +slug: use-fakernumerify-to-create-strings-with-numbers-at-specific-places +--- +A quick one that I *always* forget about -- Faker::numerify, allowing you to generate numeric data in a specific pattern ๐Ÿ‘Œ๐Ÿ‘ \ No newline at end of file diff --git a/content/tips/you-can-conditionally-skip-scheduled-jobs.md b/content/tips/you-can-conditionally-skip-scheduled-jobs.md new file mode 100644 index 0000000..aea07f1 --- /dev/null +++ b/content/tips/you-can-conditionally-skip-scheduled-jobs.md @@ -0,0 +1,11 @@ +--- +title: 'You can conditionally skip() scheduled jobs' +tweet_id: '1495414940684804100' +thread_slug: weekly-thread-2022-07 +author_username: cosmeescobedo +images: + - 'https://pbs.twimg.com/media/FL2KtKzVgAABGiG.jpg' +created_at: 2022-02-20T15:07:59+00:00 +slug: you-can-conditionally-skip-scheduled-jobs +--- +๐Ÿ”ฅ #Laravel the skip method in scheduler \ No newline at end of file diff --git a/content/tips/you-can-use-traits-inside-php-enums.md b/content/tips/you-can-use-traits-inside-php-enums.md new file mode 100644 index 0000000..e85e77e --- /dev/null +++ b/content/tips/you-can-use-traits-inside-php-enums.md @@ -0,0 +1,13 @@ +--- +title: 'You can use traits inside PHP enums' +tweet_id: '1495414934754136064' +thread_slug: weekly-thread-2022-07 +author_username: archtechx +images: + - 'https://pbs.twimg.com/media/FL_ee0mVgAUuD-u.jpg' +created_at: 2022-02-20T15:07:58+00:00 +slug: you-can-use-traits-inside-php-enums +--- +A few days ago, I learned that PHP enums can use traits + +It may seem like a massive anti-pattern, but it allows making enums actually awesome with this one trick ๐Ÿ”ฅ \ No newline at end of file diff --git a/content/tips/you-can-use-wherenumber-on-routes-instead-of-passing-a-regex-pattern-to-where.md b/content/tips/you-can-use-wherenumber-on-routes-instead-of-passing-a-regex-pattern-to-where.md new file mode 100644 index 0000000..37a3ec4 --- /dev/null +++ b/content/tips/you-can-use-wherenumber-on-routes-instead-of-passing-a-regex-pattern-to-where.md @@ -0,0 +1,11 @@ +--- +title: 'You can use whereNumber() on routes instead of passing a regex pattern to where()' +tweet_id: '1495414943612506113' +thread_slug: weekly-thread-2022-07 +author_username: Sileence +images: + - 'https://pbs.twimg.com/media/FLZ9iNEX0AcKQVD.jpg' +created_at: 2022-02-20T15:08:00+00:00 +slug: you-can-use-wherenumber-on-routes-instead-of-passing-a-regex-pattern-to-where +--- +I'm reading the Laravel 9 docs from scratch and TIL you can write your route restrictions in a more expressive way: \ No newline at end of file