p0t4t0
180
4
Laravel

What's a better way to limit a user's ability to post per day

Posted 1 year ago by p0t4t0

Right now I am thinking adding a posts_allowed column to my users table, set it to 3 maybe, then decrement it every time a user posts, when it gets to 0 i'll maybe run a check for $post->created_at > $post->created_at + 24 hrs and reset posts_allowed when it returns true.

I am not a MySQL expert but I believe this is a waste of resource especially if I set posts_allowed to integer, maybe I should set it to tinyint instead? I dunno, any suggestions? Or is there a "Laravel" way of doing this instead?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.