I posted an article today about using the database features in #PhpStorm. Anyone else reach for these by default?
seankegel.com/accessing-databases-in-phpstorm
I posted a quick tip for improving model factory performance in Laravel by better handling dependent relationship data.
seankegel.com/laravel-factories-tips-for-handling-dependent-data
I was writing out a method today that accepted an array of items as a parameter. I always try to type the array using something like: `MyObject[]`. That got me thinking about what type I should use though? Do you use `array`, `iterable`, or `Collection` if you're in the Laravel world?
I wrote a post about using a DTO to keep your JSON columns structured in #laravel. Learn about how to cast a JSON column in an Eloquent model to a DTO.
seankegel.com/laravel-casting-eloquent-json-fields
Does anyone use Laravel Pennant to store user settings? For example, I have a multi-tenant app and a user can belong to multiple tenants. I want to store which tenant is currently the user's active tenant. Does that make sense or is that best left out of Pennant?
The pivot would have a `is_current` field on it so you would look for tenants for the user with `is_current` set. However, that requires the extra work of deselecting the previous one. Though, maybe that’s solved by using a timestamp instead.