I've set up a user model for an application. I would like each user to have access to their own records after they've logged in, e.g. orders, customers, etc. How best to implement this?
My only idea is that I add a "user" field to the records which holds the id of the user it belongs to (i.e. through parent referencing). Then add some middleware which ensures that only records linked to the currently logged in user are returned. This doesn't seem very efficient but I don't really know.
Is there a better way to model the data here?