From de8e3941e1efdf25d9da6df05c21b441fc24616f Mon Sep 17 00:00:00 2001 From: lukinovec Date: Sat, 26 Mar 2022 20:24:23 +0100 Subject: [PATCH] Week 12/2022 (#29) --- content/authors/laravelnews.md | 5 +++++ content/authors/ryangjchandler.md | 2 +- content/authors/zepfietje.md | 5 +++++ content/threads/weekly-thread-2022-12.md | 11 +++++++++++ ...n-use-both-syntaxes-in-both-types-of-tests.md | 14 ++++++++++++++ content/tips/isset-accepts-multiple-arguments.md | 11 +++++++++++ ...ws-calling-dd-directly-on-the-expect-chain.md | 11 +++++++++++ ...s-to-make-laravel-encrypt-the-jobs-payload.md | 13 +++++++++++++ ...ear-all-laravel-caches-using-optimizeclear.md | 11 +++++++++++ ...n-debounce-a-function-using-alpinedebounce.md | 16 ++++++++++++++++ ...-a-given-range-right-at-the-database-level.md | 13 +++++++++++++ .../you-can-record-all-login-logout-events.md | 11 +++++++++++ ...on-by-calling-filter-without-any-arguments.md | 11 +++++++++++ ...at-makes-sure-components-render-accurately.md | 11 +++++++++++ 14 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 content/authors/laravelnews.md create mode 100644 content/authors/zepfietje.md create mode 100644 content/threads/weekly-thread-2022-12.md create mode 100644 content/tips/if-you-use-both-pest-and-phpunit-you-can-use-both-syntaxes-in-both-types-of-tests.md create mode 100644 content/tips/isset-accepts-multiple-arguments.md create mode 100644 content/tips/pest-allows-calling-dd-directly-on-the-expect-chain.md create mode 100644 content/tips/use-the-shouldbeencrypted-interface-on-a-job-class-to-make-laravel-encrypt-the-jobs-payload.md create mode 100644 content/tips/you-can-clear-all-laravel-caches-using-optimizeclear.md create mode 100644 content/tips/you-can-debounce-a-function-using-alpinedebounce.md create mode 100644 content/tips/you-can-generate-a-series-of-dates-in-a-given-range-right-at-the-database-level.md create mode 100644 content/tips/you-can-record-all-login-logout-events.md create mode 100644 content/tips/you-can-remove-all-falsy-values-from-a-collection-by-calling-filter-without-any-arguments.md create mode 100644 content/tips/you-can-start-testing-livewire-components-with-basic-tests-that-makes-sure-components-render-accurately.md diff --git a/content/authors/laravelnews.md b/content/authors/laravelnews.md new file mode 100644 index 0000000..5aa0313 --- /dev/null +++ b/content/authors/laravelnews.md @@ -0,0 +1,5 @@ +--- +username: laravelnews +name: 'Laravel News' +avatar: 'https://pbs.twimg.com/profile_images/1359866716222861317/coQ-RmRS_normal.jpg' +--- diff --git a/content/authors/ryangjchandler.md b/content/authors/ryangjchandler.md index 70a0730..59f36ba 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' name: 'Ryan Chandler' -avatar: 'https://pbs.twimg.com/profile_images/1446231529986961410/X5zL_n0h_normal.jpg' --- diff --git a/content/authors/zepfietje.md b/content/authors/zepfietje.md new file mode 100644 index 0000000..93b33fd --- /dev/null +++ b/content/authors/zepfietje.md @@ -0,0 +1,5 @@ +--- +username: zepfietje +name: 'Zep Fietje' +avatar: 'https://pbs.twimg.com/profile_images/1486773319189815314/VstRGufn_normal.jpg' +--- diff --git a/content/threads/weekly-thread-2022-12.md b/content/threads/weekly-thread-2022-12.md new file mode 100644 index 0000000..9fa0780 --- /dev/null +++ b/content/threads/weekly-thread-2022-12.md @@ -0,0 +1,11 @@ +--- +slug: weekly-thread-2022-12 +title: 'Weekly thread #12 of 2022' +tweet_id: '1507455535322308610' +author_username: archtechx +created_at: 2022-03-25T20:33: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/if-you-use-both-pest-and-phpunit-you-can-use-both-syntaxes-in-both-types-of-tests.md b/content/tips/if-you-use-both-pest-and-phpunit-you-can-use-both-syntaxes-in-both-types-of-tests.md new file mode 100644 index 0000000..25666fb --- /dev/null +++ b/content/tips/if-you-use-both-pest-and-phpunit-you-can-use-both-syntaxes-in-both-types-of-tests.md @@ -0,0 +1,14 @@ +--- +title: 'If you use both pest and PHPUnit, you can use both syntaxes in both types of tests' +tweet_id: '1507455564942495749' +thread_slug: weekly-thread-2022-12 +author_username: djgeisi +images: + - 'https://pbs.twimg.com/media/FOUNAdFXMAQI7RA.jpg' +created_at: 2022-03-25T20:33:08+00:00 +slug: if-you-use-both-pest-and-phpunit-you-can-use-both-syntaxes-in-both-types-of-tests +--- +#PestPHP #PHP Tip + +If you have a mixed codebase with Pest and PHPUnit tests you can use almost all of the pest magic in your PHPUnit tests. +It just works. \ No newline at end of file diff --git a/content/tips/isset-accepts-multiple-arguments.md b/content/tips/isset-accepts-multiple-arguments.md new file mode 100644 index 0000000..5f652a1 --- /dev/null +++ b/content/tips/isset-accepts-multiple-arguments.md @@ -0,0 +1,11 @@ +--- +title: 'isset() accepts multiple arguments' +tweet_id: '1507455541072728066' +thread_slug: weekly-thread-2022-12 +author_username: laravelnews +images: + - 'https://pbs.twimg.com/media/FOqbrYAX0AgsSNL.jpg' +created_at: 2022-03-25T20:33:02+00:00 +slug: isset-accepts-multiple-arguments +--- +It's a minor thing but the PHP `isset` function can accept multiple vars. https://www.instagram.com/p/CbctwMxgPv4/ \ No newline at end of file diff --git a/content/tips/pest-allows-calling-dd-directly-on-the-expect-chain.md b/content/tips/pest-allows-calling-dd-directly-on-the-expect-chain.md new file mode 100644 index 0000000..e2df805 --- /dev/null +++ b/content/tips/pest-allows-calling-dd-directly-on-the-expect-chain.md @@ -0,0 +1,11 @@ +--- +title: 'Pest allows calling dd() directly on the expect() chain' +tweet_id: '1507455561918390279' +thread_slug: weekly-thread-2022-12 +author_username: enunomaduro +images: + - 'https://pbs.twimg.com/media/FOibegNXsAEKTbb.jpg' +created_at: 2022-03-25T20:33:07+00:00 +slug: pest-allows-calling-dd-directly-on-the-expect-chain +--- +Pest tip: Use the `dd` method to dump the current expectation value and end the test suite. ๐Ÿ”ฆ \ No newline at end of file diff --git a/content/tips/use-the-shouldbeencrypted-interface-on-a-job-class-to-make-laravel-encrypt-the-jobs-payload.md b/content/tips/use-the-shouldbeencrypted-interface-on-a-job-class-to-make-laravel-encrypt-the-jobs-payload.md new file mode 100644 index 0000000..ab8bcd5 --- /dev/null +++ b/content/tips/use-the-shouldbeencrypted-interface-on-a-job-class-to-make-laravel-encrypt-the-jobs-payload.md @@ -0,0 +1,13 @@ +--- +title: 'Use the `ShouldBeEncrypted` interface on a job class to make Laravel encrypt the job''s payload' +tweet_id: '1507455546978287617' +thread_slug: weekly-thread-2022-12 +author_username: cosmeescobedo +images: + - 'https://pbs.twimg.com/media/FOG28lHUcAAk6Om.jpg' +created_at: 2022-03-25T20:33:04+00:00 +slug: use-the-shouldbeencrypted-interface-on-a-job-class-to-make-laravel-encrypt-the-jobs-payload +--- +๐Ÿ”ฅ #Laravel Job Encryption + +Since Laravel v8.19.0, you can add the `ShouldBeEncrypted` interface to your job class. Laravel will encrypt the job's payload automatically. \ No newline at end of file diff --git a/content/tips/you-can-clear-all-laravel-caches-using-optimizeclear.md b/content/tips/you-can-clear-all-laravel-caches-using-optimizeclear.md new file mode 100644 index 0000000..ed71619 --- /dev/null +++ b/content/tips/you-can-clear-all-laravel-caches-using-optimizeclear.md @@ -0,0 +1,11 @@ +--- +title: 'You can clear all Laravel caches using `optimize:clear`' +tweet_id: '1507455552892268546' +thread_slug: weekly-thread-2022-12 +author_username: aschmelyun +images: + - 'https://pbs.twimg.com/media/FOeOo81WYAUa42D.jpg' +created_at: 2022-03-25T20:33:05+00:00 +slug: you-can-clear-all-laravel-caches-using-optimizeclear +--- +Just found out there's a single artisan command to clear out all Laravel caches, much less typing! \ No newline at end of file diff --git a/content/tips/you-can-debounce-a-function-using-alpinedebounce.md b/content/tips/you-can-debounce-a-function-using-alpinedebounce.md new file mode 100644 index 0000000..2c1837e --- /dev/null +++ b/content/tips/you-can-debounce-a-function-using-alpinedebounce.md @@ -0,0 +1,16 @@ +--- +title: 'You can debounce a function using Alpine.debounce()' +tweet_id: '1507455555899564032' +thread_slug: weekly-thread-2022-12 +author_username: zepfietje +images: { } +created_at: 2022-03-25T20:33:06+00:00 +slug: you-can-debounce-a-function-using-alpinedebounce +--- +โ“ Using Alpine.js and need to debounce a function? + +โŒ You don't need JavaScript libraries like lodash. + +โœ… Just use Alpine.debounce() which is also used internally for the x-on:input.debounce="" modifier. + +Cc: @calebporzio \ No newline at end of file diff --git a/content/tips/you-can-generate-a-series-of-dates-in-a-given-range-right-at-the-database-level.md b/content/tips/you-can-generate-a-series-of-dates-in-a-given-range-right-at-the-database-level.md new file mode 100644 index 0000000..72d0e6a --- /dev/null +++ b/content/tips/you-can-generate-a-series-of-dates-in-a-given-range-right-at-the-database-level.md @@ -0,0 +1,13 @@ +--- +title: 'You can generate a series of dates in a given range right at the database level' +tweet_id: '1507455559049822208' +thread_slug: weekly-thread-2022-12 +author_username: tobias_petry +images: + - 'https://pbs.twimg.com/media/FOih4zwWQAsjZ-E.jpg' +created_at: 2022-03-25T20:33:07+00:00 +slug: you-can-generate-a-series-of-dates-in-a-given-range-right-at-the-database-level +--- +โšก๏ธ Database Tip + +When doing statistical aggregations by time, you may have gaps in your data. You don't have to fill them manually with code! You can generate a series of dates from a start to end time and use these days to join to your statistical data with gaps. \ No newline at end of file diff --git a/content/tips/you-can-record-all-login-logout-events.md b/content/tips/you-can-record-all-login-logout-events.md new file mode 100644 index 0000000..a979591 --- /dev/null +++ b/content/tips/you-can-record-all-login-logout-events.md @@ -0,0 +1,11 @@ +--- +title: 'You can record all login & logout events' +tweet_id: '1507455544021250049' +thread_slug: weekly-thread-2022-12 +author_username: mattkingshott +images: + - 'https://pbs.twimg.com/media/FOoOjf-XIAMPLIW.jpg' +created_at: 2022-03-25T20:33:03+00:00 +slug: you-can-record-all-login-logout-events +--- +๐Ÿ”ฅ #Laravel Tip: If your app needs to record logins and logouts for security purposes (auditing), then you should definitely make use of the auth events, which allow you to easily listen for them. diff --git a/content/tips/you-can-remove-all-falsy-values-from-a-collection-by-calling-filter-without-any-arguments.md b/content/tips/you-can-remove-all-falsy-values-from-a-collection-by-calling-filter-without-any-arguments.md new file mode 100644 index 0000000..4240afc --- /dev/null +++ b/content/tips/you-can-remove-all-falsy-values-from-a-collection-by-calling-filter-without-any-arguments.md @@ -0,0 +1,11 @@ +--- +title: 'You can remove all falsy values from a Collection by calling filter() without any arguments' +tweet_id: '1507455538078003203' +thread_slug: weekly-thread-2022-12 +author_username: ecrmnn +images: + - 'https://pbs.twimg.com/media/FOYvPYuWQAoA-2P.jpg' +created_at: 2022-03-25T20:33:02+00:00 +slug: you-can-remove-all-falsy-values-from-a-collection-by-calling-filter-without-any-arguments +--- +Laravel Collections tip. To remove all falsy values from the collection, simply call filter without any arguments โœจ \ No newline at end of file diff --git a/content/tips/you-can-start-testing-livewire-components-with-basic-tests-that-makes-sure-components-render-accurately.md b/content/tips/you-can-start-testing-livewire-components-with-basic-tests-that-makes-sure-components-render-accurately.md new file mode 100644 index 0000000..c189adf --- /dev/null +++ b/content/tips/you-can-start-testing-livewire-components-with-basic-tests-that-makes-sure-components-render-accurately.md @@ -0,0 +1,11 @@ +--- +title: 'You can start testing Livewire components with basic tests that makes sure components render accurately' +tweet_id: '1507455550027563009' +thread_slug: weekly-thread-2022-12 +author_username: ryangjchandler +images: + - 'https://pbs.twimg.com/media/FOPGoowXEAE883f.jpg' +created_at: 2022-03-25T20:33:04+00:00 +slug: you-can-start-testing-livewire-components-with-basic-tests-that-makes-sure-components-render-accurately +--- +๐Ÿ”ฅ When you're testing your @LaravelLivewire components, one of the simplest tests you can add is a "can this component be mounted" test. This is one of the best ways to test your the mounting process in isolation and ensuring the component renders the view correctly. \ No newline at end of file