I want to know the best solution for reviewing edits of a user that needs to be approved by a admin.
At the moment i have a Users
table with the following fields.
- Username
- Password
- Created_at
- Updated_at
I have a relation table user_profile
with the following fields
- User_id
- Firstname
- Lastname
- Street
- Zip
- State
- About_me
I also have a table pending_user_profile
for the approvals
- User_id
- Firstname
- Lastname
- Street
- Zip
- State
- About_me
At the moment i am checking if there is a user_id in the pending_user_profile table to show the pending data inside the edit screen on the application.
Im checking it like this: PendingUser::where('user_id', $this->id)->exists();
The pending data is also shown for the admin. (basically im just getting everything inside the pending_user_profile. So the admin knows what users have edited there information.
Im getting the data like this: PendingUser::all();
First question: I'm not sure how this will hold up when i have loads of users. So im trying to find a better solution for this, or want to know that the solution im using now is maybe totally fine and i should not be worried about it at all. Is my approach for checking for pending fields a good approach?
Second question: When storing the pending fields im not sure how to deal with it. Should i compare all fields before submitting them to the pending fields? this way im just storing the fields that are changed. The downside for this option is that i have to get data from 2 separate tables.
Any help will be appreciated.
Thanks in advance!