Home > front end >  Laravel - Allowing user to share task once per day
Laravel - Allowing user to share task once per day

Time:07-15

Please guys I seriously need your help , there is a project I am working on

I already have Task & share model

A user can only share one task per day, the user won't be allowed to share the same task again , which means each task a user share must be different but only a user is only allowed to share once per day

please how can I set this up?

CodePudding user response:

You didn't give much details about the structure but I say add a timestamp column named shared_at to tasks table. If it's filled with a timestamp, it means the task is shared. Then you can group the table by user_id and shared_at (as date) to find out if the user already shared a task or not. This could be also done with an intermediate table.

  • Related