I once read an article about changing the primary key column id of to the name of your model. So if database was named “items” , your primary id shouldn’t just be named “id” but “item_id”. Building things from scratch, this came in handy. Especially when debugging and joining tables. When you saw an error like “ambiguous name column” and you joined 3 tables, you needed to specify each table name with it’s id. And that’s just one example.
Continue reading “Changing the primary key id of a Laravel Model”