Here's how you can use PHP's spread operator to merge two arrays together. Technically this will be faster than array_merge too! Spreads also support anything implementing Traversable.

PHP

A nice tip when writing tests is to create incomplete tests for the parts that you still need to write tests for. This helps me keep track of the features that I still need to cover with tests.

Laravel

JavaScript Tip 💡 Did you know that JSON.stringify takes a replacer function as its second argument? You can use it to do filter and replace values when stringifying an object.

JavaScript

Speaking of alternative syntaxes, this is also perfectly okay in PHP.

PHP

You can also use curly braces in PHP switch statements. I honestly don't know why you'd want to do this though... Aside from the argument of readability, I haven't noticed any differences.

PHP

A lot of times I use @Alpine_JS for simple UI niceties, like fading an element out after a given time, toggling a class on click, etc. Writing all of this x-... code every single time is quite cumbersome, so I created a couple of Blade directives that make this super easy.

Laravel
JavaScript

JavaScript Tip 💡 You can use Object.entries() to iterate through the properties of an object and access both key and value. No need to do an object lookup for each iteration.

JavaScript

If you are using @spatie_be package-skeleton-laravel or your #PHPUnit generates reports in a build folder, mark your build folder as excluded so that #phpstorm doesn't index your project every time you run a test. https://t.co/BjuVxvOAC6 #Laravel

Laravel
Editors

🔹 Promise.allSettled() The Promise.allSettled() method returns a promise that resolves after all of the given promises have either fulfilled or rejected, with an array of objects that each describes the outcome of each promise.

JavaScript

🔹 Promise.all() The Promise.all() method takes an array of promises as an argument and returns a single Promise that resolves to an array of the results of the input promises.

JavaScript

💎 @LaravelLivewire gem The "$refresh" magic action is especially powerful when you want to refresh one component from another one! Here, I'm updating the DomainForm component, whenever I switch the user team within the TeamSwitcher component.

Laravel

Here's how you can skip elements with array destructuring in PHP.

PHP

The tweet will be reviewed and posted as soon as possible

{{ newSnippetForm.errors.url[0] }}

{{ newSnippetForm.errors.categories[0] }}