mirror of
https://github.com/archtechx/laravel-tips.git
synced 2025-12-12 05:14:04 +00:00
Week 12/2022 (#29)
This commit is contained in:
parent
b451d14953
commit
de8e3941e1
14 changed files with 144 additions and 1 deletions
|
|
@ -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.
|
||||
11
content/tips/isset-accepts-multiple-arguments.md
Normal file
11
content/tips/isset-accepts-multiple-arguments.md
Normal file
|
|
@ -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/
|
||||
|
|
@ -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. 🔦
|
||||
|
|
@ -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.
|
||||
|
|
@ -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!
|
||||
|
|
@ -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
|
||||
|
|
@ -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.
|
||||
11
content/tips/you-can-record-all-login-logout-events.md
Normal file
11
content/tips/you-can-record-all-login-logout-events.md
Normal file
|
|
@ -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.
|
||||
|
|
@ -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 ✨
|
||||
|
|
@ -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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue