This is a very broad question and would depend on the specifics.
For a product, the usual pattern is to retrieve a product with all its defaults from a database and then keep in memory (typically in a session). Only the copy in memory is changeable by the user, the db original is unaffected.
For a user preference, like theme, I would set your default application theme to red in the application itself, then check for any user preference for theme, if no preference, keep app default, otherwise use the preference indicated by the user.
@flarpy thanks for reply.
I have a price table which will be available to all the users but they can override the price according to their needs and this will just make a copy of record and next time user access the price which he modified it will return the modified price. While other prices will be default.
For now i am using below approach:
I just wanted to know is there a default laravel eloquent way or anything. As I need this same functionality on many type of records.
FYI - Default records are dynamic, CURD operations are performing on them as well.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community