Posts

What the F*ck Is With All the Artisan Commands: Schedules

Scheduled tasks will be a core part of our application’s life cycle. We need to be able to send invoices every month and reminder users of upcoming items. Laravel provides a clean interface for quickly setting up scheduled tasks.

Read More

Help Support This Programming Thing

This Programming Thing is a labor of love, but we’re currently losing money every month. If you would like to help us offset some of our costs please use the links below.

How You Can Help

  1. Amazon US - Just click on the link and a make purchase like you would normally and a portion of your purchase will be credited to us.
  2. Digital Ocean $100 Credit for First 60 Days - Digital Ocean is our current favorite hosting provider for VPS.

Why Foreign Key Constraints Are Not Optional

Joe was hired into a company to maintain a PHP application with a MySQL database. They would have random reports of duplicate data and data with missing information. When Joe looked into the problem 9 times out of 10 it was due to an issue where a user deleted one row but the same delete operation didn’t delete rows related to the original row. This caused that orphaned data to show up in some reports and cause odd join results in others.

SQL provides an excellent way to make sure that our databases don’t have orphaned rows or invalid relationships. Using them is a must for all table relationships.

Read More

Link Post and Podcast Roundup: July 2020 Edition

July’s links.

Read More

Working with Floating-Point Numbers in PHP

A while back we found an odd bug that only occurred with some inputs while doing calculations that involved decimals. When we performed a series of multiplications and additions and then compared our calculation with an expected result (using ==) they didn’t show up as equal.

In this article, we’ll discuss why this is and what we can do to prevent it.

Read More

Running Unit Tests With Artisan's Test Runner

In the 7.x branch, Laravel added an artisan test command which acts as a wrapper for PHPUnit. It provides information about the tests as they’re running and stops on the first failure unlike PHPUnit’s default behavior of running all the tests and showing all the failures. It also provides a nice output when the tests fail.

The following article will provide a brief overview of how we can use it and quickly compare it to phpunit.

Read More

Link Post and Podcast Roundup: June 2020 Edition

June’s links.

Read More

Creating Reusable Bootstrap Elements With Laravel's Make:Component

Bootstrap is a good system for getting an application’s layout started and it comes with lots of helpful user interface elements that we can use in our application. The downside, is there tends to be a lot of duplication in our source code to support these elements. Thankfully, Laravel added components in the 7.x branch which will allow us to reduce that duplication.

Read More

Link Post and Podcast Roundup: May 2020 Edition

Link Post Logo

May’s links.

Read More

Select Distinct With Conditions in MySQL

The other day I ran into an interesting problem with an SQL query, I needed to create the count() of all items and the count() of a specific set of items. Normally, I would use subqueries but there was so much data that the subqueries took a minute and that was not acceptable to our client (I wrote the query originally with a small amount of data and after 4 years the performance of it was horrible).

Read on to see how to fix this.

Read More
RSS

Join Our Mailing List!

View previous campaigns.

Top Posts

  1. Working With Soft Deletes in Laravel (By Example)
  2. Fixing CMake was unable to find a build program corresponding to "Unix Makefiles"
  3. Upgrading to Laravel 8.x
  4. Get The Count of the Number of Users in an AD Group
  5. Multiple Vagrant VMs in One Vagrantfile
  6. Fixing the "this is larger than GitHub's recommended maximum file size of 50.00 MB" error
  7. Changing the Directory Vagrant Stores the VMs In
  8. Accepting Android SDK Licenses From The OSX Command Line
  9. Fixing the 'Target class [config] does not exist' Error
  10. Using Rectangle to Manage MacOS Windows

subscribe via RSS

All content copyright This Programming Thing 2012 - 2021
Blogging about PHP, MySQL, Zend Framework, MySQL, Server Administration and Programming in general