Skip to content

Blog

Page 8 of 77 - keep going...

Using Eloquent's when method cleans up code

Laravel gives a lot of syntactical sugar helpers. This allows you to write your Laravel code in a few different flavors or dialects. Some programmers prefer using fluent interfaces, others composition, and others pure functional statements.

As a seasoned and salty programmer, I tend to stick with what I know. It can be easy to overlook the helpers that Laravel provides. But, with Eloquent, the when function is way more useful than a simple helper. The true eloquence comes from its handling of the results of the first condition check.

Mar 25, 2025 2 min read #laravel

How I Launch a Laravel Testbed

Sometimes I need to spin up a quick Laravel instance on my Mac to test something out. With just a couple keystrokes, I can get a brand new Laravel instance running in a Docker container, ready for my IDE and testing. Here’s how.

Jan 16, 2025 2 min read #laravel

What is the best framework for a super small task?

“If you only have a hammer, everything is viewed as a nail” is an idiom referred to as Maslow’s hammer. It basically means that if you only know one tool, and you over-rely on it, you’ll only use that tool to solve every problem, regardless of whether it’s the right one for the job. (It’s a common saying around these parts… that and Joel’s famous saying “Do you even have a 5th bathroom if the floor isn’t heated?”)

Laravel is quite the Swiss Army Knife - it has easy solutions for just about every problem and task you have. That’s why I’m such a fan of it. But is it always the right tool for the job?

Oct 22, 2024 2 min read #laravel #php #programming

Show Alpine Element After Delay

Showing and hiding AlpineJS elements on click or other actions are pretty easy. But what if you just wanted to show the element after a little bit of a delay with no user interaction? We can do that easily!

Sep 2, 2024 2 min read #javascript

Let's Refactor a Javascript Snippet for Adding Class on Scroll

There’s a common design pattern on a lot of websites to alter the header when the user scrolls down. A lot of times this is simply some sort of handler that adds a class (or removes it). (There are other complex, arguably ‘better’ solutions with IntersectionObserver - but that’s not the point of this article.) Let’s take a look at a very simple version of a script that watches for scroll and adds/removes a class on the body. Then, let’s make it better - and learn while we do it.

Sep 2, 2024 4 min read #javascript

Laravel Display Markdown Easily in Blade

I love writing in Markdown - and offering that functionality in WYSIWYG editors for our users. But, it just seems so complicated to try to show markdown in Laravel blade files. So, I made a quick anonymous component that makes this easier.

Sep 2, 2024 2 min read #laravel