Posts

New Layout!

New Layout

Welcome to the new layout for thisprogrammingthing.com! This redesign has been on our minds for a while now and it’s great to be able to finally get it out to everyone!

Setting Up Better PHPUnit to Run Inside a Vagrant VM

PHPUnit Logo

For the last several months, I’ve been using Visual Studio Code for all my PHP projects. I started using Better PHPUnit to run my unit tests because it has a quick keyboard shortcut to run a specific unit test from inside Code. I just set Better PHPUnit up on a new computer I forgot a couple of hoops I had to jump through in order to get it to run inside my Vagrant VM. This post is documentation so I won’t forget and that will hopefully help someone else.

Read More

Link Post and Podcast Roundup: December 2019 Edition

Link Post Logo

December’s links.

Read More

Debugging the Eloquent Query Builder

Laravel Logo

The other day I had an Eloquent query that wasn’t returning what I expected it to. I started looking for a way to determine what was happening “under the hood” so to speak. It turns out it’s very simple.

// Enable query log
DB::enableQueryLog(); 

$users = User::where('email', '=', 'scott@test.com')->get();

// get the results
dd(DB::getQueryLog()); 

This will output something like the following:

array (
  0 => 
  array (
    'query' => 'select * from `users` where `email` = ?',
    'bindings' => 
    array (
      0 => 'scott@test.com',
    ),
    'time' => 2.75,
  ),
)

Can we all agree dd() is the best thing for quick debugging ever?

Defining Relationships In Laravel 5.6 and 6.x

Laravel Logo

I wanted to take a quick break in my barrage of Artisan posts to write about defining one-to-many and many-to-many relationships in Laravel’s Eloquent. Eloquent also supports one-to-one relationships but I felt like those are used so rarely that I could skip it.

Read More

Link Post and Podcast Roundup: November 2019 Edition

Link Post Logo

November’s links.

Read More

What the F*ck Is With All the Artisan Commands: Development Helpers

Laravel Logo

Here are two useful commands that you can use every day and one that’s good for getting yourself setup.

Read More

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

Laravel Logo

As I’ve been organizing the flow of this series there’s a random set of commands that don’t really have a good home. I thought I would cover them now so they’re out of the way.

Read More

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

Laravel Logo

Now that we’ve learned how to create our migrations it’s time to discuss how to work with them using the migrate family of commands.

Read More

Link Post and Podcast Roundup: October 2019 Edition

Link Post Logo

October’s links.

Read More

subscribe via RSS

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