Not quite ready to sign up? Want to know more first?
Check out our most recent articles below, and then sign up to get a new Laravel tip each day!
-
Minimizing risk with production data migrations
Sometimes you need to reshape some core, critical data in production. You might wish there was a way around it, but the best choice is to bite the bullet and do it. How can you approach this in a way that will give you the greatest confidence nothing will go wrong when it’s deployed? There…
-
Just do it the right way
On a recent project, a feature request came in that was very similar to an existing feature, but the client assured me “only one company will probably ever use this”. That planted the seed in my mind that it was “overkill” to follow the existing pattern and build out all the same features. I tried…
-
Why I don’t use `dropIfExists` in down methods
When you use the make:migration –create=table_name command in Laravel, the generated migration will look like this: In our projects, we always change that down method from dropIfExists to drop. It’s a small thing, but there really should be no circumstance where you already ran this migration and the new table did not get created. The one place this could happen is if…
-
A use case for the `value-of` PHPDoc type
On a recent project, I was building up a configuration object that would be stored in a json field in the database. Some records would require more configuration options than others, but I wanted to restrict it so that the keys in this json object had to be values from a particular enum. Let’s say…