Go crazy with Blade directives

🔥 Go crazy with Blade directives. The simplest things can abstract away tons of visual noise from your templates. pic.twitter.com/p5udGWJkhd — David Hemphill (@davidhemphill) June 22, 2017 Freek Van der Herten Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After […]

Continue reading →

Comparing model collections

Cool little Laravel 5.5 Eloquent Collection macro to assert two model collections are the same 🤙🏻 pic.twitter.com/zzbkr1fL9T — Adam Wathan (@adamwathan) June 14, 2017 Freek Van der Herten Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes […]

Continue reading →

Using request()->query()

On Twitter I see a bunch of people regularly tweeting very nice code snippets. Instead of only retweeting those, I’m going to add them to my blog. I’ll tag them with tweet. Here’s the first one: request()->query() is a life saver when dealing with tables that store "sorts" and "filters" in a query string. pic.twitter.com/84P6xvTvSz […]

Continue reading →

Performant Laravel

Chris Fideo, of Servers For Hackers and Shipping Docker, published a new free video serious on optimizing performance for Laravel apps. He shows how to use the built in artisan commands such as config:cache and route:cache,how to optimize queries, build up good indexes and how to add an object cache in a clean way. There […]

Continue reading →

The status antipattern

In a new blogpost on vemv.net the author (I couldn’t find his real name) argues against using a simple status field. Dear programmer, do you ever use the name state for your variables? Like state = 42? “Hell no, that’s a terribly generic word. Better to use the domain-specific wording the variable refers to: is_invoiced, […]

Continue reading →

Make your app fly with PHP OPcache

Recently this button to optimize PHP’s OPcache was added to Laravel Forge. If you were wondering what PHP OPcache is all about and what pressing this button does with your application, read this article Olav van Schie wrote on the subject a while ago. Every time you execute a PHP script, the script needs to […]

Continue reading →

Bootable Model Traits

On the Tighten co blog Caleb Porzio wrote a small post on how you can boot your model traits. It’s a very handy feature that’s being used a quite a few Spatie packages. TL;DR Use bootNameOfTrait() instead of boot() in a model trait to avoid being overwritten by the base model’s boot() method. https://blog.tighten.co/laravel-tip-bootable-model-traits Freek […]

Continue reading →

Diving Laravel

Mohammed Said, Laravel employee number #1, recently announced that he published a new site where he shares stuff he learned while researching the Laravel code base. The site is called “Diving Laravel”, which is kinda nice knowing that Mohammed is an incredible diver himself. In this website I’m going to share notes on the internals […]

Continue reading →

JavaScript’s comma operator

Vitaly Gordon explains how the little known comma operator makes it easy to add some debugging statements in short hand array functions. What if you want to add a console.log call before x + 1 ? With comma operator, adding side-effects to functional expressions is simple: const fun = x => (console.log (x), x + […]

Continue reading →