Skip to content

Latest commit

 

History

History
7 lines (4 loc) · 969 Bytes

File metadata and controls

7 lines (4 loc) · 969 Bytes

Database Design

Eloquent and Spot don’t do much of their work via SQL when it comes to eager loading relations. Eloquent does seem to do a join but then has to match the related entities up to the base entities anyway. Spot runs a separate query to load the relations.

Good article on the Active Repository anti-pattern, though it doesn’t offer any solution to the issue of calling $model->save() in the controller for a simple insert or update. Top level entities can almost always be saved based on their relation to the user though.

When you want to avoid adding a soft delete or status column to a database table because it’s going to make constraints inelegant and/or fragile to enforce, consider separating the table into a table for each state, e.g. active_subscriptions, cancelled_subscriptions. Source