All individual subscriptions are 50% off this week only!

chrisgrim
2 months ago
126
5
Laravel

How specific to be with my Model creation?

Posted 2 months ago by chrisgrim

Hi, I have a more best practices question. I am creating a site where users can create organizers/events and I am running into an interesting question. Normally I would just set up my project so that the name needs to be unique so I can't have Post1 and Post1. However, I'm wondering if that isn't enough for users entering the events. I base my RouteKey off slug and that adds some interesting problems. Suddenly one user can add Post 1 and another can add Post-1 and that passes my validation tests fine but errors out on submission to my database. Also, what if a user adds an event called 'Dinowars' and another enters one called 'Dino Wars'. They are obviously the same event and I don't want them entered twice. How do you deal with this?

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