how to make a varchar nullable and unique together in mysql (laravel)
I know this is an old question, this is for others who have the same issue.
You are trying to add an empty string. You made column nullable and unique. That means you are trying something you shouldn't. You can send multiple null values but not mutiple empty string. MySQL consider empty as a value.
or you could write a mutator in your modal
public function setEmailAttribute($value) { if ( empty($value) ) { // will check for empty string $this->attributes['email'] = NULL; } else { $this->attributes['email'] = $value; }}