10
๐ฅ 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.
๐ฅ This week's code tips for Laravel developers
A weekly thread ๐งต
10
#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.
9
โก๏ธ 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.
8
Pest tip: Use the dd
method to dump the current expectation value and end the test suite. ๐ฆ
7
โ 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
6
Just found out there's a single artisan command to clear out all Laravel caches, much less typing!
5
๐ฅ #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.
4
๐ฅ 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.
3
๐ฅ #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.
2
It's a minor thing but the PHP isset
function can accept multiple vars. https://www.instagram.com/p/CbctwMxgPv4/
1
Laravel Collections tip. To remove all falsy values from the collection, simply call filter without any arguments โจ
We're writing a book, you can get it for free here. We're writing a book! Join the early access to get it for free.