samedi 17 octobre 2015

Laravel 5.1 don't allow duplicate gecko name for current user

I have a situation with my app and I shall do my best to explain what it is i'm trying to do.

In my migration, I made my gecko name column unique ($table->string('name')->unique()). This obviously means that gecko names must be unique across the board for all users - this isn't what I want to do, I want to make sure that the current user cannot use the same name for another gecko.

For example:

If user 1 makes a gecko called Bob and user 2 made a gecko called Bob that would be fine.

If user 1 made a gecko called Bob, and then made another gecko called Bob - This wouldn't be fine.

What is the best way/practice to make this work?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire