/ tag
Laravel
3 posts on this topic.
-
Polymorphic models in Laravel: one table, two different records (Eloquent morphs)
A CRM tracked two kinds of record that shared almost no fields but flowed through the same statuses, teams, and dashboards. I modeled it as one table with a polymorphic child — and hung the whole framework off the shared root. Mostly it worked; a couple of seams are worth showing.
-
Aggregating in SQL vs in memory: a Laravel dashboard performance lesson
Two chart methods in an old Laravel CRM — one aggregates counts in SQL, the one right below it loads every record into memory and sums them in a PHP closure. A dashboard performance lesson at millions of rows, and the junior-to-mid growth arc behind it.
-
Strangling a legacy database into Laravel (my first big migration, mistakes included)
My first serious Laravel app wasn't greenfield — it had to swallow years of data from a legacy call-center system with tables named `lead` and `hotkey`. Here's the anti-corruption layer and the chunked migration engine I built, and the parts I'd do differently now.