Image for post
Image for post

This is just a quickie post — it actually is a short email exchange I had with a new Laravel user who was wrestling with the old question of what is the more appropriate way of adding data to a production table, migrations or seeders?

“Please correct me if I’m wrong but my understanding is that migrations are for schema and seeders are for data. That being said, I realize that we can call seeders from migrations and I think that’s fine but what I see a lot of is that team members are using migrations to add data to…


Image for post
Image for post

Programmer — a person who follows a perfect plan to arrive at a point the plan was supposed to help them avoid arriving at

This is something new I want to try for a while as part of my own self-improvement that I hope will be helpful to others. I am going to write a new, very succinct analysis of a real bug or technical debt problem from code I’ve either written myself or worked on.

We all start every project or feature with “the perfect plan” that this time is going to keep us out of a mess of…


Image for post
Image for post
Is she in your code right now?

(This is part of my Things I’ve Screwed Up With Code series.)

(A short note about the title — this is not about Clean Code. This is about code that is “excessively clean”.)

I’d like to show you a bug you may have in your own applications somewhere.

Grab any Laravel app you have lying around and open a console. We’ll do this mainly with Tinker and it will work better if you have a database connection, but just a simple User model is sufficient.

Start with this: $u = \App\User::first() . That should bring back the full user record…


Image for post
Image for post

(I wonder if I can make that title any geekier?)

Let’s start by describing what the parts of this task are, and what we are doing today. The overall goal is this:

We want all of our application files to meet a certain code style, and so to make it less cumbersome to enforce this, we’d like to use PHP-CS-Fixer (https://github.com/FriendsOfPHP/PHP-CS-Fixer).

However, trying to get the whole team to always remember to run this before pushing code is like herding cats, so we’d also like to make that an automated part of the commit process.

Have no fear! What I’ll…


“State Machine”

Does that send shivers of high-level, computer science theory dread through your body? Another one of those “I should dig into that someday” feelings?

Fear not! I’m going to walk you though a very simple but practical use case of these that will have you wondering how you ever got by without them.

Let’s start with a simpler description of what this is all about. Have you ever had a bug ticket to look into that was essentially, “This Order had a status of ‘cancelled’, but then it was somehow changed to ‘pending’. Please look into it.”?

This…


Image for post
Image for post
Normally this image would be a dark, hooded figure with a stream of letters and numbers rising above their head. Hackers don’t look like that, nor work that way.

TL;DR; — this is a quick read for non-computer technical people to understand some basics about that login screen, how to identify some sites that don’t protect your password adequately, and *why* you need to do a few of the things to protect yourself that programmers are always telling you. If you *are* technical, please pass this along.

Here’s everything you need to know about encryption:

  • Don’t ever make your own.
  • Properly encrypted passwords are extremely difficult to “decrypt” (return to a normal string of letters) by an outside source
  • Encryption takes whatever word or group of characters you give it and turns it into a weird set…


Let me show you something.

Have a quick look at this code:

Image for post
Image for post
Simple display of user id passed into function

Now look at the rest of it:


Image for post
Image for post
At least it’s over

We all have failures. It may be a traditional “death march”, or something more
subtle such as not achieving the smooth work flow process we had hoped to manage this time, or even just taking longer to deliver than expected. If it is important to review projects that went well to ensure we can repeat and improve, then it is doubly so to look at ones that were less than ideal.

However, a lot of consultants who do this type of review don’t get much of anything out of it. Instead of stepping back and make an honest, neutral assessment…


Image for post
Image for post
An artist’s representation of what is happening to your company

“How long will that take to make?”

Ah, the old dreaded words. Let’s all run to Twitter now and whine about how “this has never been created before” and “they don’t understand software” — and anyway, we all know you should never rush an artist.

This will be a short piece, so I’m not going to go down that rabbit hole right now, but tell me one thing: When a construction company is handed a one-of-a-kind blueprint of a new house, do they respond, “Well, golly gee! …


Image for post
Image for post
…or anything, really

One issue you will face if you need to make a multi-lingual site is how to keep your translations organized for both your back-end framework and your javascript components. I’m going to demonstrate the basic technique for this, using Laravel and Vue.js for my example.

What is this?

You should know right off the bat that the technique I’m showing is completely framework — and even language — agnostic. The idea behind it would work just as well for a .Net app fronted with Ember.js, for example.

I’m writing this at two levels, so you are free to read according to what you…

Jeff Madsen

Developer and head of http://mahana-designs.com. I write about Laravel, Vue.js and Life. https://twitter.com/codebyjeff

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store