In Laravel / PHP its easy to create accessors and mutators to transform or create dynamic fields from a database.
Although its too easy to duplicate this same logic throughout your app, when you are not accessing the same data through an ORM model (e.g. direct queries).
$order->totalPlusTax; // (total * 10%)
The logic to calculate this field should be written once, testable and tied into an ORM.
What are best practices or design patterns around this logic?
Aucun commentaire:
Enregistrer un commentaire