Loach's avatar
Level 11

Whats a good approach to file and data approvals.

I currently let user upload video to my website. Then can attach a .zip file as well. The video has the the fields "title", "description", etc.

I need to be able to approve the video when it is created and updated. I was thinking of having a field "needs approval" that I set to true upon creation and on approval set it to false. Then upon updating I would reset it to true again.

Then within the same column having the fields "title_updated", "description_updated" etc. Then if I approve setting the normal fields to the updated fields and clearing the updated fields for the next time it needs approval.

Is there a better approach to this.

0 likes
1 reply
fylzero's avatar
fylzero
Best Answer
Level 67

@loach I think that approach is fine. One adjustment I'd suggest is instead of using needs_approval = false I would do approved_at as a timestamp and default it to null. When it is approved set the field to now() (Carbon helper assuming Laravel)... that way you can use the timestamp essentially asa boolean and have a log of when it was approved. I'm really big on this approach because you never know if knowing when something happened might be useful. You might even want to create an approved_by field as well to log the user who approved it. Just a thought.

Please or to participate in this conversation.