Upgrading Laravel Homestead
Upgrading Laravel Homestead on my system requires a few additional steps not outlined in the official documentation. Instead of recreating them from memory each time I wanted to collect the items here.
Fixing Segmentation Fault Error on CircleCI
Try disabling xdebug if you get a segmentation fault error when running php unit tests on CircleCI. Xdebug is installed automatically on some docker images and can cause segfaults during the build process.
Renaming a Column with a Foreign Key in Laravel
This database originally used "customer_id" as the column name for the owner of each row, however the actual model being referenced was a "User". Here's how I changed the name of the column (which happened to have a foreign key on it) via Laravel migration:
For When Things Get Gnarly in Eloquent
Jonathan Reinink has written some excellent content around Eloquent and this article is one that I reference frequently. Jonathan walks us through handling sticky situations when we need to get a single record back from a relationship without causing N+1 issues.
Eager Loading Polymorphic Relations
Derek MacDonald wrote a nice post about eager loading polymorphic relationships. This has been a difficult item to solve so it's nice to see a documented approach that works for many scenarios. Thanks Derek!
Building a Laravel / MQTT App on Laravel Forge
Using a simple node script you can subscribe to an MQTT broker and forward messages to a Laravel application. Take a look at this article to see how we connected inexpensive temperature sensors to a web app for logging and reporting issues.
Troubleshooting NFS Shared Folders in Homestead
Every now and then I will attempt to start Laravel Homestead on my mac and will get an error indicating a problem with mounting the NFS shared folders.After entering the password into the command line the console will output:
Importing a PG Dump from the Command Line
Similar to the time formats I wrote about here, I can not seem to remember the syntax for importing a PostgreSQL dump file into a database from the command line!...
Mocking Fluent Laravel Facade Chains
Laravel offers a few different ways to test facades but the documentation doesn't cover testing individual calls within a fluent chain. As is normally the case with Laravel, testing in this fashion is totally doable... I wrote about the process over...
Using WhereHas in Laravel Polymorphic Relations
Techniques like these are important to document because we bump into them frequently, but not frequently enough to have it memorized!
It seems like once every project I find myself googling "Laravel Polymorphic WhereHas", combing through one result after another, frustratedly repeating "How do I do this???".
While there isn't a first-party supported solution, I wanted to document what has been working for me, so I don't have to continue searching StackOverflow!
Page 1 of 2 (12 total entries)